You are here

public function ldap_views_handler_sort_attribute::options_form in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_views/handlers/ldap_views_handler_sort_attribute.inc \ldap_views_handler_sort_attribute::options_form()
  2. 7 ldap_views/handlers/ldap_views_handler_sort_attribute.inc \ldap_views_handler_sort_attribute::options_form()

Basic options for all sort criteria

Overrides views_handler_sort::options_form

File

ldap_views/handlers/ldap_views_handler_sort_attribute.inc, line 25
Base sort handler for a ldap attributes.

Class

ldap_views_handler_sort_attribute

Code

public function options_form(&$form, &$form_state) {
  $ldap_data = new LdapQuery(ldap_views_get_qid($this->view));
  if (empty($ldap_data)) {
    $form['attribute_name'] = [
      '#markup' => 'You must select a valid LDAP search (Advanced::Query settings)',
    ];
    return;
  }
  parent::options_form($form, $form_state);
  $options = [];
  foreach ($ldap_data->attributes as $attribute) {
    $options[$attribute] = $attribute;
  }
  $form['attribute_name'] = [
    '#type' => 'select',
    '#title' => t('Attribute name'),
    '#description' => t('The attribute name from LDAP response'),
    '#options' => $options,
    '#default_value' => $this->options['attribute_name'],
    '#required' => TRUE,
  ];
}