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

Overrides EntityReferenceBehaviorHandler::settingsForm().

Overrides EntityReferenceBehaviorHandler::settingsForm

File

core/modules/entityreference/plugins/behavior/EntityReferenceBehaviorHandlerTaxonomyIndex.inc, line 168
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 settingsForm($field, $instance) {
  $form = array();
  $target = $field['settings']['target_type'];
  if ($target != 'taxonomy_term') {
    $form['ti-on-terms'] = array(
      '#markup' => t('This behavior can only be set when the target type is taxonomy_term, but the target of this field is %target.', array('%target' => $target)),
    );
  }

  $entity_type = $instance['entity_type'];
  if ($entity_type != 'node') {
    $form['ti-on-nodes'] = array(
      '#markup' => t('This behavior can only be set when the entity type is node, but the entity type of this instance is %type.', array('%type' => $entity_type)),
    );
  }

  if (!config_get('taxonomy.settings', 'maintain_index_table')) {
    $form['ti-disabled'] = array(
      '#markup' => t('This core setting "maintain_index_table" is disabled.'),
    );
  }
  return $form;
}