PluginElementRenderer interface provides information about the context in which an Element is being rendered, and functions to generate the Element HTML using templates.
Automatically created by the built in Element rendering API, and passed to renderer functions. See Elements.
The name of the Element being rendered.
The path of the page requested by the user.
StoreObject this Element is being displayed next to, if the Element is being rendered on an object page.
Otherwise, this property is
A hint about how the Element should be rendered. Values can be
"wide", depending on where on the page the Element will be displayed.
Any options specified by the system administrator when declaring the Element to be displayed in a context. The options are decoded from JSON.
If no options are specified, or there is an error decoding them, this property is
function render(view, templateName)
This function generates the Element HTML by rendering a
templateName argument is optional. If it’s not specified or is
null, then an implied name will be used. This is the name of the Element, without the plugin name prefix. For example, the
example_plugin:test Element would use the
test template unless another template was specified.
As well as the values required by the template, the
view should contain the
title key. This specifies the title of the Element. Use
"" if you don’t want a title to be displayed above the Element.
function renderLinks(links, title)
This is a shortcut to implementing the common case of displaying links to plugin functionality on the application home page.
links is an array of two element arrays, containing the path and text for the link. For example,
[ ['/do/example/action_one', 'Action One'], ['/do/example/action_two', 'Action Two'] ]
title is the title of the Element.