You are here

function crumbs_CrumbsEntityPlugin_TokenDisabled::entityFindCandidate in Crumbs, the Breadcrumbs suite 7.2

Parameters

object $entity: The entity on this path.

string $entity_type: The entity type

string $distinction_key: Typically the bundle name. On user entities, this is one of the roles of the user. (this might be called more than once per user)

Return value

string A candidate for the parent path or title.

Overrides crumbs_EntityPlugin::entityFindCandidate

1 method overrides crumbs_CrumbsEntityPlugin_TokenDisabled::entityFindCandidate()
crumbs_CrumbsEntityPlugin_TokenEnabled::entityFindCandidate in lib/CrumbsEntityPlugin/TokenEnabled.php

File

lib/CrumbsEntityPlugin/TokenDisabled.php, line 25

Class

crumbs_CrumbsEntityPlugin_TokenDisabled

Code

function entityFindCandidate($entity, $entity_type, $distinction_key) {

  // This is cached..
  $patterns = variable_get('crumbs_' . $entity_type . '_parent_patterns', array());
  if (!empty($patterns[$distinction_key])) {
    $parent = $patterns[$distinction_key];

    // Only accept candidates where all tokens are fully resolved.
    // This means we can't have literal '[' in the path - so be it.
    if (FALSE === strpos($parent, '[')) {
      return $parent;
    }
  }
  return NULL;
}