You are here

function crumbs_InjectedAPI_hookCrumbsPlugins::entityTitleCallback in Crumbs, the Breadcrumbs suite 7.2

Register a callback that will determine a title for a breadcrumb item with an entity route. The behavior will be available for all known entity routes, e.g. node/% or taxonomy/term/%, with different plugin keys.

Parameters

string $key: The plugin key under which this callback will be listed on the weights configuration form.

callback $callback: The callback, e.g. an anonymous function. The signature must be $callback(stdClass $entity, string $entity_type, string $distinction_key), like the findCandidate() method of a typical crumbs_EntityPlugin.

array $types: An array of entity types, or a single entity type, or NULL to allow all entity types.

File

lib/InjectedAPI/hookCrumbsPlugins.php, line 139

Class

crumbs_InjectedAPI_hookCrumbsPlugins
API object to be used as an argument for hook_crumbs_plugins() This is a sandbox class, currently not used..

Code

function entityTitleCallback($key, $callback, $types = NULL) {
  $entity_plugin = new crumbs_EntityPlugin_Callback($callback, $this->module, $key, 'entityTitle');
  $this
    ->entityPlugin('title', $key, $entity_plugin, $types);
  $this->callbackCollection
    ->addCallback($this->module, 'entityTitle', $key, $callback);
}