1 EntityReferenceBehaviorHandlerTaxonomyIndex.inc public EntityReferenceBehaviorHandlerTaxonomyIndex::access($field, $instance)

Overrides EntityReferenceBehaviorHandler::access().

Ensure that it is only enabled for ER instances on nodes targeting terms, and the core setting to maintain index is enabled.

Overrides EntityReferenceBehaviorHandler::access

File

core/modules/entityreference/plugins/behavior/EntityReferenceBehaviorHandlerTaxonomyIndex.inc, line 24
Plugin class for the taxonomy behavior.

Class

EntityReferenceBehaviorHandlerTaxonomyIndex
Extends an entityreference field to maintain its references to taxonomy terms in the {taxonomy_index} table.

Code

public function access($field, $instance) {
  if ($instance['entity_type'] != 'node' || $field['settings']['target_type'] != 'taxonomy_term') {
    return;
  }

  if ($field['storage']['type'] !== 'field_sql_storage') {
    // Field doesn't use SQL storage.
    return;
  }

  return config_get('taxonomy.settings', 'maintain_index_table');
}