Mecha CMS

Mecha CMS blog and documentation.

Filter Hooks

Updated: Sunday, 07 August 2016

List of the available filter hooks.

Related: [article:class-filter]

Shield

FilterDescription
shield:pathWill affect the generated shield path.
shield:lotWill affect the generated lot data.
shield:inputWill affect the shield input when output buffer is enabled.
shield:outputWill affect the shield output when output buffer is enabled.

Chunk

FilterDescription
chunk:pathWill affect the generated chunk path.
chunk:lotWill affect the generated lot data.
chunk:inputWill affect the chunk input when output buffer is enabled.
chunk:outputWill affect the chunk output when output buffer is enabled.

Meta

FilterDescription
metaWill affect the page metadata.

Page

FilterDescription
titleWill affect the title field.
nameWill affect the name field.
emailWill affect the email field.
urlWill affect the URL data.
statusWill affect the status data.
slugWill affect the URL slug data.
descriptionWill affect the description field.
shortcodeWill affect the page content before Markdown parsing. Prioritized to handle the shortcodes.
content_rawWill affect the page content before Markdown parsing.
contentWill affect the page content after Markdown parsing.
css_rawWill affect the CSS field value before the shortcode being parsed.
js_rawWill affect the JavaScript field value before the shortcode being parsed.
cssWill affect the CSS field value.
jsWill affect the JavaScript field value.
custom:cssWill affect the custom CSS field value of article or page.
custom:jsWill affect the custom JavaScript field value of article or page.

Asset

FilterDescription
asset:urlWill affect the asset URL.
asset:sourceWill affect the raw asset URL input.
asset:pathWill affect the generated asset file path.
asset:inputWill affect the asset content before minify.
asset:outputWill affect the asset content after minify.
asset:stylesheetWill affect the HTML markup of the CSS assets.
asset:javascriptWill affect the HTML markup of the JavaScript assets.
asset:imageWill affect the HTML markup of the image assets.

Guardian

FilterDescription
guardian:kickWill affect the URL redirection.

Tree

FilterDescription
trunkWill affect the generated trunk.
branchWill affect the generated branch.
twigWill affect the generated twig.
urlWill affect the generated URL.
anchorWill affect the generated anchor and span tag.

Widget

FilterDescription
widgetWill affect the widget HTML markup.
widget:recentWill affect the recent widget HTML markup.
widget:randomWill affect the random widget HTML markup.
widget:relatedWill affect the related widget HTML markup.
widget:customWill affect the custom widget HTML markup.
widget:managerWill affect the manager widget HTML markup.
widget:manager.menuWill affect the manager menu widget HTML markup.
widget:manager.barWill affect the manager bar widget HTML markup.
widget:archiveWill affect the archive widget HTML markup.
widget:archive.hierarchyWill affect the archive hierarchy widget HTML markup.
widget:archive.listWill affect the archive list widget HTML markup.
widget:archive.dropdownWill affect the archive dropdown widget HTML markup.
widget:tagWill affect the tag widget HTML markup.
widget:tag.listWill affect the tag list widget HTML markup.
widget:tag.cloudWill affect the tag cloud widget HTML markup.
widget:tag.dropdownWill affect the tag dropdown widget HTML markup.
widget:searchWill affect the search widget HTML markup.
widget:search.formWill affect the search form widget HTML markup.
widget:recent.postWill affect the recent post widget HTML markup.
widget:recent.commentWill affect the recent comment widget HTML markup.
widget:recent.responseWill affect the recent comment widget HTML markup.
widget:random.postWill affect the random post widget HTML markup.
widget:related.postWill affect the related post widget HTML markup.
widget:custom.my_custom_widgetWill affect the custom Widget::myCustomWidget() and Widget::my_custom_widget() widget HTML markup.
widget:custom.myCustomWidgetThis filter will affect the custom Widget::myCustomWidget() widget HTML markup.

Article

FilterDescription

{{print path="class-get/table_data.filters.post" lot="article"}}

Page

FilterDescription

{{print path="class-get/table_data.filters.post" lot="page"}}

Comment

FilterDescription
comment:idWill affect the comment ID.
comment:postWill affect the comment post ID.
comment:parentWill affect the comment parent ID.
comment:timeWill affect the comment time.
comment:dateWill affect the comment date.
comment:nameWill affect the comment name.
comment:emailWill affect the comment email.
comment:urlWill affect the comment URL.
comment:statusWill affect the comment status.
comment:statusWill affect the comment status.
comment:fieldsWill affect the comment fields.
comment:fields.favoriteWill affect the comment field item called favorite.
comment:permalinkWill affect the comment permalink·

Tag

FilterDescription
tag:idWill affect the tag ID.
tag:nameWill affect the tag name.
tag:slugWill affect the tag slug.
tag:descriptionWill affect the tag description.
tag:scopeWill affect the tag scope.

Pagination

FilterDescription
pager:urlWill affect the pagination URL.
pager:anchorWill affect the pagination anchor link.
pager:prev.urlWill affect the pagination URL of the previous navigation.
pager:next.urlWill affect the pagination URL of the next navigation.
pager:prev.anchorWill affect the pagination anchor link of the previous navigation.
pager:next.anchorWill affect the pagination anchor link of the next navigation.
pager:step.urlWill affect the numbered pagination URL.
pager:step.anchorWill affect the numbered pagination anchor link.
pager:step.htmlWill affect the generated HTML output of numbered pagination.

Others

Filter names are mostly created automatically based on the array key. Some of them are not useful, but you may will need them personally to allow you to make some modifications without having to modify the core directly. The stable filter names listed in the table above are intended for the plugin development purposes.

You can do some test by adding this command to the functions.php file of your active shield:

Weapon::add('shield_after', function() {
    $results = array_keys(Filter::exist());
    sort($results);
    echo implode('<br>', $results);
});

After that, visit your blog page and look at the very bottom of the page. You should see some dummy text that looks like this:

article:author
article:content
article:description
article:fields
article:fields.allow_comments

…

article:shortcode
article:title
author
comment:email
comment:message
comment:name
comment:shortcode
comment:status
comment:url
content
description
email
fields
message
name
page:content
shortcode
status
title
url
widget
widget:archive
widget:archive.hierarchy
widget:custom
widget:custom.social_sharing_buttons
widget:manager
widget:manager.menu
widget:search
widget:tag
widget:tag.list

…
Donation and Email Subscription