You are here

public function EntityReferenceBehavior_TaxonomyIndex::access in Entity reference 7

Overrides EntityReference_BehaviorHandler_Abstract::access().

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

Overrides EntityReference_BehaviorHandler_Abstract::access

File

plugins/behavior/EntityReferenceBehavior_TaxonomyIndex.class.php, line 24
CTools plugin class for the taxonomy-index behavior.

Class

EntityReferenceBehavior_TaxonomyIndex
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 variable_get('taxonomy_maintain_index_table', TRUE);
}