You are here

public function ACKEntityTaxonomyTermReference::settingsForm in Access Control Kit 7

Overrides AccessControlKitHandler::settingsForm().

Overrides AccessControlKitHandler::settingsForm

File

handlers/ack_entity_taxonomy_term_reference.inc, line 43
Contains the handler class for term reference fields on entities.

Class

ACKEntityTaxonomyTermReference
Controls access to an entity based on a taxonomy term reference field.

Code

public function settingsForm() {

  // Find all term reference fields that work with the scheme's vocabulary.
  $options = array();
  if (!empty($this->vocabulary)) {
    $fields = field_read_fields(array(
      'type' => 'taxonomy_term_reference',
    ));
    foreach ($fields as $field_name => $field) {
      if (!empty($field['settings']['allowed_values']) && $field['settings']['allowed_values'][0]['vocabulary'] == $this->vocabulary) {
        $options[$field_name] = check_plain($field_name);
      }
    }
  }
  $form['field_name'] = array(
    '#title' => t('The term reference field'),
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => $this->fieldName,
  );
  return $form;
}