You are here

public function EntityReferenceBehavior_TaxonomyIndex::settingsForm in Entity reference 7

Overrides EntityReference_BehaviorHandler_Abstract::settingsForm().

Overrides EntityReference_BehaviorHandler_Abstract::settingsForm

File

plugins/behavior/EntityReferenceBehavior_TaxonomyIndex.class.php, line 168
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 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 (!variable_get('taxonomy_maintain_index_table', TRUE)) {
    $form['ti-disabled'] = array(
      '#markup' => t('This core variable "taxonomy_maintain_index_table" is disabled.'),
    );
  }
  return $form;
}