TokenEnabled.php in Crumbs, the Breadcrumbs suite 7.2
File
lib/CrumbsEntityPlugin/TokenEnabled.php
View source
<?php
class crumbs_CrumbsEntityPlugin_TokenEnabled extends crumbs_CrumbsEntityPlugin_TokenDisabled {
function entityFindCandidate($entity, $entity_type, $distinction_key) {
$patterns = variable_get('crumbs_' . $entity_type . '_parent_patterns', array());
if (empty($patterns[$distinction_key])) {
return NULL;
}
$info = entity_get_info($entity_type);
$token_data = array(
$info['token type'] => $entity,
);
$token_options = array(
'language' => $GLOBALS['language'],
'callback' => 'crumbs_clean_token_values',
);
$parent = token_replace($patterns[$distinction_key], $token_data, $token_options);
if (empty($parent)) {
}
if (FALSE !== strpos($parent, '[')) {
return NULL;
}
return $parent;
}
}