static function crumbs_Util::itemExtractEntity in Crumbs, the Breadcrumbs suite 7.2
Extract an entity from a router item, even if the wildcard loader has been replaced or removed.
Parameters
array $item: The loaded router item.
string $entity_type: The entity type, e.g. 'node' or 'taxonomy_term'.
int $index: Index in $item['map'] at which to expect the entity.
Return value
stdClass|FALSE The entity object.
13 calls to crumbs_Util::itemExtractEntity()
- blog_CrumbsMonoPlugin_authorName::findTitle__blog_x in plugins/
crumbs.blog.inc - Still under constructon..
- blog_CrumbsMonoPlugin_authorPage::findParent__node_x in plugins/
crumbs.blog.inc - Still under constructon..
- crumbs_example_CrumbsMultiPlugin_ListOfNews::findParent__node_x in example/
lib/ CrumbsMultiPlugin/ ListOfNews.php - Set news/(year)/(month)/(day) as the parent for a node. You can use the weights config at Admin > Structure > Crumbs to specify which node types this should apply to.
- crumbs_MultiPlugin_EntityFindSomething::find in lib/
MultiPlugin/ EntityFindSomething.php - forum_CrumbsMonoPlugin_forumTerm::findParent__forum_x in plugins/
crumbs.forum.inc - Forums get their parent forums as breadcrumb parent. The method name matches the router path "forum/%". Forums are actually taxonomy terms, just the path is different.
File
- lib/
Util.php, line 107
Class
- crumbs_Util
- Static methods that don't fit elsewhere. Ideally these are all stateless and do not depend on anything. But at least one of them is not..
Code
static function itemExtractEntity($item, $entity_type, $index = NULL) {
if (!isset($index)) {
$index = count($item['map']) - 1;
}
if ($item['map'][$index] instanceof stdClass) {
return $item['map'][$index];
}
$entities = entity_load($entity_type, array(
$item['original_map'][$index],
));
return reset($entities);
}