The Rendered Content widget calls into the renderer of a Moodle plugin and returns the content to the current page. This allows a plugin developer to create functions in their plugin designed to embed content for display in other parts of Moodle, eg an HTML block on the dashboard or a label on the site home.


This widget is not set up by default, and does not show in the Atto editor. This is because it is most likely to be used by developers and designers, and not teachers or students. 


1) Create a template from the preset


Visit: Site Administration -> Plugins -> Filters -> Poodll Filter -> Templates


From an empty template's settings page, select the "Renderered Content" preset. 

Then save the settings page.


2) Create a function in your renderer


In your plugin's renderer create a function whose name begins with "embed_"

If it does not begin with "embed_" it will not be called. The arguments to the function must be strings or integers, since they will be passed in as plain text. If you need access to the module context and other objects you should instantiate those from within the renderer function.


e.g


  


3) Call the template from somewhere


In the filter string as params, pass in the:


Param KeyParam ExampleParam Description
renderermod_mymodThis is basically the frankenstyle component name. sub renderers are not supported yet.
functionembed_userchartThe function must exist in the renderer and begin with "embed_"
args34|john jones|0This is a pipe delimited string. The order and number of the args between the pipes must match the order and number of args of the renderer function.




So a rendered content filter string might look like this:

{POODLL:type="renderedcontent",renderer="mod_mycoolmod",function="embed_userchart",args="2128|billybob"}


A Warning

If the renderer or renderer function or renderer function args do not exist or don't match, an error will be thrown. Its best to test the filter string on a blank page activity so you can isolate any thrown error issues.