Exemplo n.º 1
0
 /**
  * @param string $module
  * @param string $key
  * @param string $callback_type
  *   E.g. 'routeParent'.
  *
  * @return callback
  */
 function restoreCallback($module, $key, $callback_type)
 {
     if (!isset($this->modulesRestored[$module])) {
         $f = $module . '_crumbs_plugins';
         // The module may have been disabled in the meantime,
         // or the function may have been removed by a developer.
         if (function_exists($f)) {
             $this->api->setModule($module);
             $f($this->api);
         }
         $this->modulesRestored[$module] = TRUE;
     }
     return $this->callbackCollection->getCallbackOrFalse($module, $callback_type, $key);
 }
Exemplo n.º 2
0
 /**
  * Register a callback that will determine a title for a breadcrumb item.
  *
  * @param string $route
  *   The route where this callback should be used, e.g. "node/%".
  * @param string $key
  *   The plugin key under which this callback will be listed on the weights
  *   configuration form.
  * @param callback $callback
  *   The callback, e.g. an anonymous function. The signature must be
  *   $callback(string $path, array $item), like the findParent() method of
  *   a typical crumbs_MonoPlugin.
  */
 function routeTitleCallback($route, $key, $callback)
 {
     $this->routeMonoPlugin($route, $key, new crumbs_MonoPlugin_TitleCallback($callback, $this->module, $key));
     $this->callbackCollection->addCallback($this->module, 'routeTitle', $key, $callback);
 }