TokenDisabled.php in Crumbs, the Breadcrumbs suite 7.2
File
lib/CrumbsEntityPlugin/TokenDisabled.php
View source
<?php
class crumbs_CrumbsEntityPlugin_TokenDisabled implements crumbs_EntityPlugin {
function describe($api, $entity_type, $keys) {
$patterns = variable_get('crumbs_' . $entity_type . '_parent_patterns', array());
foreach ($keys as $key => $title) {
if (empty($patterns[$key])) {
unset($keys[$key]);
}
else {
$api
->addRule($key, $title);
$api
->descWithLabel('"' . check_plain($patterns[$key]) . '"', t('Parent'), $key);
}
}
}
function entityFindCandidate($entity, $entity_type, $distinction_key) {
$patterns = variable_get('crumbs_' . $entity_type . '_parent_patterns', array());
if (!empty($patterns[$distinction_key])) {
$parent = $patterns[$distinction_key];
if (FALSE === strpos($parent, '[')) {
return $parent;
}
}
return NULL;
}
}