]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/plugin/PluginManager.php
Merge pull request #1552 from ArthurHoaro/feature/better-initializer
[github/shaarli/Shaarli.git] / application / plugin / PluginManager.php
index b3e8b2f8e28c0ebdd9def9e8d7f8df00c7f4e903..7881e3bea1675ad02b5d255fca316792cdd81f00 100644 (file)
@@ -112,11 +112,20 @@ class PluginManager
             $data['_BASE_PATH_'] = $params['basePath'];
         }
 
+        if (isset($params['bookmarkService'])) {
+            $data['_BOOKMARK_SERVICE_'] = $params['bookmarkService'];
+        }
+
         foreach ($this->loadedPlugins as $plugin) {
             $hookFunction = $this->buildHookName($hook, $plugin);
 
             if (function_exists($hookFunction)) {
-                $data = call_user_func($hookFunction, $data, $this->conf);
+                try {
+                    $data = call_user_func($hookFunction, $data, $this->conf);
+                } catch (\Throwable $e) {
+                    $error = $plugin . t(' [plugin incompatibility]: ') . $e->getMessage();
+                    $this->errors = array_unique(array_merge($this->errors, [$error]));
+                }
             }
         }
     }