You are here

public function EntityHierarchy::applies in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 modules/entity_hierarchy_workbench_access/src/Plugin/AccessControlHierarchy/EntityHierarchy.php \Drupal\entity_hierarchy_workbench_access\Plugin\AccessControlHierarchy\EntityHierarchy::applies()

File

modules/entity_hierarchy_workbench_access/src/Plugin/AccessControlHierarchy/EntityHierarchy.php, line 261

Class

EntityHierarchy
Defines a hierarchy based on an entity hierarchy field.

Namespace

Drupal\entity_hierarchy_workbench_access\Plugin\AccessControlHierarchy

Code

public function applies($entity_type_id, $bundle) {
  if ($entity_type_id !== $this->pluginDefinition['entity']) {
    return FALSE;
  }
  if (!in_array($bundle, $this->configuration['bundles'], TRUE)) {
    return FALSE;
  }
  $fields = $this->entityFieldManager
    ->getFieldMapByFieldType('entity_reference_hierarchy');
  return isset($fields[$entity_type_id][$this->pluginDefinition['field_name']]);
}