You are here

function ldap_views_handler_filter_attribute::value_form in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.2 ldap_views/handlers/ldap_views_handler_filter_attribute.inc \ldap_views_handler_filter_attribute::value_form()
  2. 7.2 ldap_views/handlers/ldap_views_handler_filter_attribute.inc \ldap_views_handler_filter_attribute::value_form()

Provide a simple textfield for equality

Overrides ldap_views_handler_filter::value_form

File

ldap_views/handlers/ldap_views_handler_filter_attribute.inc, line 49
Basic textfield filter to handle string filtering commands for a generic ldap attribute Includes new criterias

Class

ldap_views_handler_filter_attribute
@file Basic textfield filter to handle string filtering commands for a generic ldap attribute Includes new criterias

Code

function value_form(&$form, &$form_state) {

  /*
      $current_display = $this->view->display[$this->view->current_display];
      $qid             = isset($current_display->display_options['query']['options']['qid']) ? $current_display->display_options['query']['options']['qid']
                                                                                             : $current_display->handler->default_display->display->display_options['query']['options']['qid'];
  */
  $ldap_data = new LdapQuery(ldap_views_get_qid($this->view));

  //ldap_data_load($qid);
  if (empty($ldap_data)) {
    $form['attribute_name'] = array(
      '#markup' => 'You must select a valid LDAP search (Advanced::Query settings)',
    );
    return;
  }
  $options = array();
  foreach ($ldap_data->attributes as $attribute) {
    $options[$attribute] = $attribute;
  }
  if (empty($form_state['exposed'])) {
    $form['attribute_name'] = array(
      '#type' => 'select',
      '#title' => t('Attribute name'),
      '#description' => t('The attribute name from LDAP response'),
      '#options' => $options,
      '#default_value' => $this->options['attribute_name'],
      '#required' => TRUE,
    );
  }
  parent::value_form($form, $form_state);
}