You are here

protected function CalendarViewsTrait::isTermReferenceField in Calendar 8

Determine if this field is Entity Reference field that references a taxonomy term.

@todo Change to a more generic is Content Entity Reference.

Parameters

$field_info:

\Drupal\Core\Entity\EntityFieldManagerInterface $field_manager: The entity field manager service.

1 call to CalendarViewsTrait::isTermReferenceField()
Calendar::buildOptionsForm in src/Plugin/views/row/Calendar.php
Provide a form for setting options.

File

src/CalendarViewsTrait.php, line 44

Class

CalendarViewsTrait
The trait.

Namespace

Drupal\calendar

Code

protected function isTermReferenceField($field_info, EntityFieldManagerInterface $field_manager) {
  if (!empty($field_info['type']) && $field_info['type'] == 'entity_reference_label') {
    if ($entity_type = $this
      ->getTableEntityType($field_info['table'])) {
      $field_definitions = $field_manager
        ->getFieldStorageDefinitions($entity_type);
      $field_definition = $field_definitions[$field_info['field']];
      $target_type = $field_definition
        ->getSetting('target_type');
      return $target_type == 'taxonomy_term';
    }
  }
  return FALSE;
}