Contents

cms.component.beforeInit

Triggered in Cms\Classes\Controller\HasComponentHelpers.

Provides an opportunity to inspect or decorate a component after it is constructed and attached to the page/layout/partial, immediately before $component->init() is called.

Example usage (access gate before component bootstrapping):

Event::listen('cms.component.beforeInit', function ((\Cms\Classes\ComponentBase) $component) {
    // Gate or decorate the component before init()
});

Or

$component->bindEvent('component.beforeInit', function () {
    // Local listener on this component instance
});