You are here

public function AccessCheck::isAnyTaxonomyTermFieldDefinedInNodeType in Permissions by Term 8.2

1 call to AccessCheck::isAnyTaxonomyTermFieldDefinedInNodeType()
AccessCheck::canUserAccessByNode in src/Service/AccessCheck.php

File

src/Service/AccessCheck.php, line 240

Class

AccessCheck
AccessCheckService class.

Namespace

Drupal\permissions_by_term\Service

Code

public function isAnyTaxonomyTermFieldDefinedInNodeType(string $nodeType) {
  $fieldDefinitons = $this->entityFieldManager
    ->getFieldDefinitions('node', $nodeType);
  foreach ($fieldDefinitons as $fieldDefiniton) {
    if ($fieldDefiniton
      ->getType() === 'entity_reference' && is_numeric(strpos($fieldDefiniton
      ->getSetting('handler'), 'taxonomy_term'))) {
      return TRUE;
    }
  }
}