You are here

protected function HierarchicalTaxonomyMenuBlock::isMediaImage in Hierarchical Taxonomy Menu 8

Whether a field is media type of image.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field: A field to check.

Return value

bool TRUE if this field is media type of image.

1 call to HierarchicalTaxonomyMenuBlock::isMediaImage()
HierarchicalTaxonomyMenuBlock::getVocabularyOptions in src/Plugin/Block/HierarchicalTaxonomyMenuBlock.php
Generates vocabulary select options.

File

src/Plugin/Block/HierarchicalTaxonomyMenuBlock.php, line 425

Class

HierarchicalTaxonomyMenuBlock
Provides a 'HierarchicalTaxonomyMenuBlock' block.

Namespace

Drupal\hierarchical_taxonomy_menu\Plugin\Block

Code

protected function isMediaImage(FieldDefinitionInterface $field) {
  if ($field
    ->getType() == 'entity_reference' && $field
    ->getSetting('target_type') == 'media') {
    if (isset($field
      ->getSetting('handler_settings')['target_bundles']['image'])) {
      return TRUE;
    }
  }
  return FALSE;
}