hElementRender

Render an Element as HTML for inclusion into a web page.

You shouldn’t use this hook directly. Use the default implementation provided by the JavaScript Plugin object. See Elements for details.

If you implement this hook directly, you should test the name argument, and if it matches an element you implement, generate the HTML and title.

The options are not decoded, and are passed as Strings. By convention these are in JSON format.

Arguments

Name Type Description
name String The name of the Element to render
path String Where the Element is being rendered
object StoreObject The object the Element is being displayed with, or null
style String How the Element should be rendered
options String Options for rendering the Element

Response

Return information by changing these properties of the response object.

Name Type Description
title String The title to be displayed above this Element, or the empty string for no title
html String The HTML to output for this Element

JavaScript template


P.hook('hElementRender', function(response, name, path, object, style, options) {
    // Respond to hook, for example
    // response.title = ...
});