onContentArrayLoaded
This event is triggered after the markdown content of a page has been converted into an array by the parsedown library and before the array has been transformed into html. This is useful if you want to insert content after specific html-elements.
Availability
This event is available on all frontend pages.
Data
Plugins must return a content-array for this event; otherwise, the content will not be available in the frontend.
Getter/Setter | Type | Required | Description |
---|---|---|---|
getData | array | - | A multi-dimensional array of content elements generated by the parsedown library. |
setData | array | required | The original or modified content array that is used by parsedown to create the html for the frontend. |
Example Data
Array
(
[0] => Array
(
[name] => p
[handler] => Array
(
[function] => lineElements
[argument] => A Standard Operating Procedure (SOP) is a detailed, written set of instructions that describes the step-by-step process for carrying out routine activities within an organization. SOPs are designed to ensure consistency, efficiency, and quality in performing specific tasks or operations.
[destination] => elements
)
)
[1] => Array
(
[name] => p
[handler] => Array
(
[function] => lineElements
[argument] => SOPs are widely used, especially in regulated industries such as manufacturing, healthcare, finance, food service, and research laboratories. They can cover a wide range of activities, from simple tasks to complex processes, making them essential for maintaining standards and ensuring compliance.
[destination] => elements
)
)
)
Example Usage
<?php
namespace plugins\myplugin;
use \typemill\plugin;
class myplugin extends plugin
{
public static function getSubscribedEvents()
{
return [
'onContentArrayLoaded' => 'onContentArrayLoaded'
];
}
public function onContentArrayLoaded($plugindata)
{
$contentArray = $plugindata->getData();
// do something and return the breadcrumb
$plugindata->setData($contentArray);
}
}
See also
- onMardkownLoaded event for plugin developers.
- onContentArrayLoaded event for plugin developers.