You are here

function crumbs_EntityPlugin_Field_EntityReference::fieldFindCandidate in Crumbs, the Breadcrumbs suite 7.2

Parameters

array $items:

Return value

string

Overrides crumbs_EntityPlugin_Field_Abstract::fieldFindCandidate

File

lib/EntityPlugin/Field/EntityReference.php, line 8

Class

crumbs_EntityPlugin_Field_EntityReference

Code

function fieldFindCandidate(array $items) {
  $field = $this
    ->getFieldInfo();
  if ($target_type = $field['settings']['target_type']) {
    foreach ($items as $item) {
      if (1 && !empty($item['target_id']) && ($target_entities = entity_load($target_type, array(
        $item['target_id'],
      ))) && ($uri = entity_uri($target_type, reset($target_entities)))) {
        return $uri['path'];
      }
    }
  }
  return NULL;
}