Snippet · Mecha CMS

Code snippet collection for developers.

Disable Page Hooks

Author: Taufik Nurrohman · 278 Views

Tweet

Force to disable all hooks that should be applied to the given page property.

Applies to Mecha version 2.0.1 and above. Previous versions will use the first argument as the default value of $page->title if $page->title value is null.

echo $page->title(false);

Example:

Hook::set('page.title', function($title) {
    return '<mark>' . $title . '</mark>';
});

$test_1 = $page->title;
$test_2 = $page->title(false);

Result:

$test_1 = '<mark>Page Title</mark>';
$test_2 = 'Page Title';

0 Comments

No comments yet.