Template events are dispatched from the blog skins by using the <mango:Event> tag. In addition to the normal Event properties, a TemplateEvent will contain these properties:
requestdata: Everything currently in the request scope
contextdata: when the event is dispatched inside a Post, Comment, or Category, it will contain the tag data.
Its data (event.data) property will also contain an attributes key with any additional information passed to the <mango:Event> tag from the template. You can access this by getting the event.data.attributes key.
Dispatched right before the <head> tag is closed. It can be used to add any additional tag inside the HTML head, such as custom style sheets or scripts.
Dispatched right after the HTML <body> tag is opened.
Dispatched right after the tags (ie: <div>) containing the footer are open. Useful for adding content to the beginning of the footer.
Dispatched right before the tags (ie: <div>) containing the footer are closed. Useful for adding content to the end of the footer.
Dispatched right before the <body> tag is closed.
Events of this type are dispatched before and after content is added or modified. They are of the type UpdateEvent. In addition to the Event properties, they contain:
oldItem: the item that was updated in its state previous to the update. If this is an "add" event, this item will be empty (verify)
newItem: the updated item (or the new item added)
changeByUser: author object that made the modification
Dispatched when a user tries to add a post. Your plugin has the opportunity here to stop the event if it considers that the post should not be added (ie: doesn't validate, etc).
Data also contains a rawdata property (event.data.rawdata) that contains all the form elements sent by the user. This is empty when user has entered the post via the API.
Dispatched after a post has been successfully added. It will contain any additional property that was added in the process (ie: the post ID).
Data also contains a rawdata property (event.data.rawdata) that contains all the form elements sent by the user. This is empty when user has entered the post via the API.
Dispatched when a post is about to be updated.
Data also contains a rawdata property (event.data.rawdata) that contains all the form elements sent by the user. This is empty when user has entered the post via the API.
Dispatched after the post has been updated.
Data also contains a rawdata property (event.data.rawdata) that contains all the form elements sent by the user. This is empty when user has entered the post via the API.
Same as beforePostAdd, but for pages.
Same as afterPostAdd, but for pages.
Same as beforePostUpdate, but for pages.
Same as afterPostUpdate, but for pages.
Same as beforePostAdd, but for comments.
Same as afterPostAdd, but for comments.
Same as beforePostUpdate, but for comments.
Same as afterPostUpdate, but for comments.
Events of this type are dispatched before and after content is deleted. They are of the type DeleteEvent. In addition to the Event properties, they contain:
oldItem: the item that is to be deleted or was deleted.
changeByUser: author object that made the delete.
Dispatched when a post is about to be deleted.
Dispatched after a post was deleted.
Dispatched when a page is about to be deleted.
Dispatched after a page was deleted.
Dispatched when a comment is about to be deleted.
Dispatched after a comment was deleted.
Events of this type are dispatched when an object "getter". These events are used to modify an object properties when they are about to be displayed without modifying the actual object. For example, this type of event is used to add formatting to comments or to add more data to a post body.
They are of the type ObjectAccessEvent. In addition to the Event properties, they contain:
originalObject: the object from which we are trying to retrieve the property. Its properties should not be modified and it is added to the event as a reference.
accessObject: the object the plugin can modify and will be used for property retrieval.
Important: If you want to modify properties before they are displayed, you only change the access object and not the original object.
Dispatched before retrieving the post id.
Dispatched before retrieving the post name (alias).
Dispatched before retrieving the post title.
Dispatched before retrieving the post content.
Dispatched before retrieving the post excerpt.
Dispatched before retrieving the post author id.
Dispatched before retrieving the post author object.
Dispatched before retrieving the post commentsAllowed property.
Dispatched before retrieving the post status.
Dispatched before retrieving the post last modified date.
Dispatched before retrieving the post URL.
Dispatched before retrieving the post number of comments.
Dispatched before retrieving the post date posted.
Dispatched before retrieving the post categories.
Dispatched before retrieving a custom field from the post.
Dispatched before retrieving the page id.
Dispatched before retrieving the page name (alias).
pageGetTitle
Dispatched before retrieving the page title.
pageGetContent
Dispatched before retrieving the page content.
postGetExcerpt
Dispatched before retrieving the page excerpt.
pageGetAuthorId
Dispatched before retrieving the page author id.
pageGetAuthor
Dispatched before retrieving the page author object.
pageGetCommentsAllowed
Dispatched before retrieving the page commentsAllowed property.
pageGetStatus
Dispatched before retrieving the page status.
pageGetLastModified
Dispatched before retrieving the page last modified date.
pageGetUrl
Dispatched before retrieving the post's URL.
pageGetCommentCount
Dispatched before retrieving the page number of comments.
pageGetCustomField
Dispatched before retrieving a custom field from the page.
getParentPageId
Dispatched before retrieving the parent id from the page.
getTemplate
Dispatched before retrieving the page template.
getHierarchy
Dispatched before retrieving the page hierarchy.
Dispatched before retrieving the page sorting order.
Dispatched before retrieving an comment's content.
Dispatched before retrieving the name of the person that made the comment.
Dispatched before retrieving the email of the person that made the comment.
Dispatched before retrieving the website address of the person that made the comment.
Dispatched before retrieving the date the comment was made
Dispatched before retrieving the rating of the comment (this property is not currently used)
Dispatched before retrieving the "approved" property the comment.
Dispatched before retrieving the id of the author of the comment (if any)
Dispatched before retrieving the id of the parent comment (this property is not currently used)
Events of this type are dispatched when a collection is retrieved as a query from the database, right after it has been transformed to objects (posts, pages, comments, etc).
They are of the type CollectionEvent. In addition to the Event properties, they contain:
query: the original query used to create the array of objects
collection: the array of objects
arguments: the arguments passed to the function that was called to get the collection
Not yet implemented
Not yet implemented
Events of this type are of class AdminMenuEvent.
Property:
links: used to add links to the admin menu
This event also contains a method called "addLink" to add another link to those already in the event. Example:
<cfset link = structnew() />
<cfset link.owner = "yourPluginName">
<cfset link.page = "settings" />
<cfset link.title = "Your Link Name" />
<cfset link.eventName = "showYourPluginSettings" />
<cfset arguments.event.addLink(link)>
Your plugin must also listen to "showYourPluginSettings" event in order to show a page in the admin.
Dispatched at the end of the main menu in case plugins want to add links
Dispatched at the end of the sub-navigation in the Setting page of the administrator.
In these events you can only modify the request data (passed as event.data property).
Dispatched before a post template is displayed. You can use this event to change the "postTemplate" property if you want to use a different template instead of the default post.cfm from your skin based on some criteria.
Dispatched before a page template is displayed. You can use this event to change the "pageTemplate" property if you want to use a different page template based on some criteria.