Esempio 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);
 }
Esempio n. 2
0
 /**
  * Restore/load all callbacks declared in the given module's implementation of
  * hook_crumbs_plugins(), e.g. via $api->routeParentCallback().
  *
  * @param string $module
  */
 protected function restoreModuleCallbacks($module)
 {
     $f = $module . '_crumbs_plugins';
     if (!function_exists($f)) {
         // The module may have been disabled in the meantime,
         // or the function has been removed by a developer.
         $this->callbacks[$module] = array();
         return;
     }
     $this->discoveryOngoing = TRUE;
     $this->api->setModule($module);
     $f($this->api);
     $this->discoveryOngoing = FALSE;
     $this->callbacks[$module] = $this->api->getModuleCallbacks($module);
 }
Esempio n. 3
0
/**
 * A hook to register crumbs plugins.
 *
 * @param crumbs_InjectedAPI_hookCrumbsPlugins $api
 *   An object with methods to register plugins.
 *   See the class definition of crumbs_InjectedAPI_hookCrumbsPlugins, which
 *   methods are available.
 */
function hook_crumbs_plugins($api)
{
    $api->monoPlugin('something');
    $api->multiPlugin('somethingElse');
}
Esempio n. 4
0
 /**
  * Information returned from hook_crumbs_plugins()
  *
  * @return crumbs_InjectedAPI_Collection_CollectionResult
  *
  * @see crumbs_PluginSystem_PluginInfo::$discovery
  */
 protected function get_discovery()
 {
     $this->includePluginFiles;
     // Pass a by-reference parameter to the $api object, that can only be
     // changed from here.
     $api = new crumbs_InjectedAPI_hookCrumbsPlugins($pluginCollection = new crumbs_InjectedAPI_Collection_PluginCollection(), $entityPluginCollection = new crumbs_InjectedAPI_Collection_EntityPluginCollection(), new crumbs_InjectedAPI_Collection_CallbackCollection(), $defaultValueCollection = new crumbs_InjectedAPI_Collection_DefaultValueCollection());
     foreach (module_implements('crumbs_plugins') as $module) {
         $function = $module . '_crumbs_plugins';
         $api->setModule($module);
         $function($api);
     }
     $entityPluginCollection->finalize($pluginCollection);
     return new crumbs_InjectedAPI_Collection_CollectionResult($pluginCollection, $defaultValueCollection);
 }
Esempio n. 5
0
 /**
  * Information returned from hook_crumbs_plugins()
  *
  * @param crumbs_Container_CachedLazyPluginInfo $container
  * @return crumbs_InjectedAPI_hookCrumbsPlugins
  */
 function discovery($container)
 {
     $container->includePluginFiles;
     $discovery_ongoing = TRUE;
     $api = new crumbs_InjectedAPI_hookCrumbsPlugins($discovery_ongoing);
     foreach (module_implements('crumbs_plugins') as $module) {
         $function = $module . '_crumbs_plugins';
         $api->setModule($module);
         $function($api);
     }
     $discovery_ongoing = FALSE;
     $api->finalize();
     return $api;
 }