/**
  * @param string $type
  *   Either 'title' or 'parent'.
  * @param string $key
  *   The plugin key under which this callback will be listed on the weights
  *   configuration form.
  * @param string|crumbs_EntityPlugin $entity_plugin
  * @param string[]|string|NULL $types
  *   An array of entity types, or a single entity type, or NULL to allow all
  *   entity types.
  */
 protected function entityPlugin($type, $key, $entity_plugin, $types)
 {
     if (!isset($entity_plugin)) {
         $class = $this->module . '_CrumbsEntityPlugin';
         $entity_plugin = new $class();
     } elseif (is_string($entity_plugin)) {
         $class = $this->module . '_CrumbsEntityPlugin_' . $entity_plugin;
         $entity_plugin = new $class();
     }
     if ($entity_plugin instanceof crumbs_EntityPlugin) {
         $this->entityPluginCollection->entityPlugin($type, $this->module . '.' . $key, $entity_plugin, $types);
     }
 }
Exemple #2
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);
 }