You are here

function crumbs_example_CrumbsMultiPlugin_ListOfNews::describe in Crumbs, the Breadcrumbs suite 7

Same name and namespace in other branches
  1. 7.2 example/lib/CrumbsMultiPlugin/ListOfNews.php \crumbs_example_CrumbsMultiPlugin_ListOfNews::describe()

Parameters

$api :crumbs_InjectedAPI_describeMultiPlugin: Injected API object, with methods that allow the plugin to further describe itself. The plugin is supposed to tell Crumbs about all possible rule keys, and can give a label and a description for each.

Return value

As an alternative to the API object's methods, the plugin can simply return a key-value array, where the keys are the available rules, and the values are their respective labels.

Overrides crumbs_MultiPlugin::describe

File

example/lib/CrumbsMultiPlugin/ListOfNews.php, line 9

Class

crumbs_example_CrumbsMultiPlugin_ListOfNews
Note: We could achieve the same with the nodeParent / entityParent, but we do it with a custom plugin for a showcase.

Code

function describe($api) {

  // We will have a separate rule per node type on Admin > Structure > Crumbs.
  foreach (node_type_get_types() as $type_name => $type) {
    $api
      ->addRule($type_name, $type->name);
  }
}