Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Plugins order

Started by Muut Archive 10 years ago · 1 replies · 328 views
10 years ago

Hi,
is there a way to set the plugins loading order? AdvancedPageCache plugin should be the first run, when used.

10 years ago

While plugin 'order' is not really possible. You can configure the order of the event methods. This actually allow more flexibility. This is done via the numeric value when you register events in the plugin:

JS
        $this->enable([
            'onMarkdownInitialized' => ['onMarkdownInitialized', 0],
            'onShortcodeHandlers' => ['onShortcodeHandlers', 0],
            'onPageContentProcessed' => ['onPageContentProcessed', 0],
            'onPageInitialized' => ['onPageInitialized', 0],
            'onTwigPageVariables' => ['onTwigPageVariables', 0],
            'onTwigSiteVariables' => ['onTwigSiteVariables', 0],
        ]);

You just change that 0 to a higher number to ensure it's called first.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago