diff --git a/Herbert/Framework/Application.php b/Herbert/Framework/Application.php index ee7c3e1..d7e34f0 100644 --- a/Herbert/Framework/Application.php +++ b/Herbert/Framework/Application.php @@ -239,10 +239,10 @@ protected function notifyMismatched() }, $this->mismatched); $message = 'Unfortunately plugin(s) ' - . implode(', ', $mismatched) - . ' can’t work with the following plugin(s) ' - . implode(', ', $matched) - . '. Please disable and try updating all of the above plugins before reactivating.'; + . implode(', ', $mismatched) + . ' can’t work with the following plugin(s) ' + . implode(', ', $matched) + . '. Please disable and try updating all of the above plugins before reactivating.'; Notifier::error($message); } @@ -255,50 +255,52 @@ protected function notifyMismatched() */ public function loadPlugin($config) { - $this->loadPluginRequires( - array_get($config, 'requires', []) - ); - - $this->loadPluginRoutes( - 'router', - array_get($config, 'routes', []) - ); - - $this->loadPluginPanels( - 'panel', - array_get($config, 'panels', []) - ); - - $this->loadPluginX( - 'enqueue', - array_get($config, 'enqueue', []) - ); - - $this->loadPluginX( - 'shortcode', - array_get($config, 'shortcodes', []) - ); - - $this->loadPluginX( - 'widget', - array_get($config, 'widgets', []) - ); - - $this->loadPluginAPIs( - array_get($config, 'apis', []) - ); - - $this->addPluginTwigNamespaces( - array_get($config, 'views', []) - ); - - $this->addPluginViewGlobals( - array_get($config, 'viewGlobals', []) - ); - - $this->addPluginComposers( - array_get($config, 'viewComposers', []) - ); + add_action('init', function () use ($config) { + $this->loadPluginRequires( + array_get($config, 'requires', []) + ); + + $this->loadPluginRoutes( + 'router', + array_get($config, 'routes', []) + ); + + $this->loadPluginPanels( + 'panel', + array_get($config, 'panels', []) + ); + + $this->loadPluginX( + 'enqueue', + array_get($config, 'enqueue', []) + ); + + $this->loadPluginX( + 'shortcode', + array_get($config, 'shortcodes', []) + ); + + $this->loadPluginX( + 'widget', + array_get($config, 'widgets', []) + ); + + $this->loadPluginAPIs( + array_get($config, 'apis', []) + ); + + $this->addPluginTwigNamespaces( + array_get($config, 'views', []) + ); + + $this->addPluginViewGlobals( + array_get($config, 'viewGlobals', []) + ); + + $this->addPluginComposers( + array_get($config, 'viewComposers', []) + ); + }); } /**