====== TPL_METAHEADER_OUTPUT ======
---- dataentry event ----
Description: Manipulate meta headers
DefaultAction: Sends the meta headers to the browser
Preventable: yes
Added_dt: 2006-09-16
----
This event is signalled by [[xref>tpl_metaheaders()]] in [[xref>inc/template.php]] after preparing the default meta headers. You can use it to manipulate the meta headers before they're sent to the browser.
===== Passed Data =====
$data is a two-dimensional array of all meta headers. The keys are ''meta'', ''link'' and ''script''.
Here is an example for using the data property to add meta information, stylesheets and JavaScript
// Adding a meta value
$event->data["meta"][] = [
"name" => "DC.Subject",
"content" => "Some information"
];
// Adding a stylesheet
$event->data["link"][] = [
"type" => "text/css",
"rel" => "stylesheet",
"href" => DOKU_BASE . "lib/plugins/myplugin/specialstyle.css"
];
// Adding a JavaScript File
$event->data["script"][] = [
"type" => "text/javascript",
"src" => DOKU_BASE . "lib/plugins/myplugin/javascript_library.js",
"_data" => ""
];
// Adding JavaScript Code
$event->data["script"][] = [
"type" => "text/javascript",
"charset" => "utf-8",
"_data" => "addInitEvent(function(){comments_addButtons('$ID');});"
];
Note:
* When you are adding the stylesheet or javascript file for compatibility with using slash as namespace separator in URLs you should prepend the file link with DOKU_BASE.
* For adding the javascript file you should specify an empty ''_data'' field for generating of a closing "script" tag, otherwise you get an incorrect self closed "script" tag.
* You may use other tags as well
$event->data['style'][] = [
'type' => 'text/css',
'_data' => 'a {color: blue;}'
];
===== See also =====
* [[codesearch>TPL_METAHEADER_OUTPUT|Code related to this event]] used in any DokuWiki's files, plugins and templates
* [[devel:Action Plugins]]
* [[devel:Events]]