public function ldap_views_handler_argument_attribute::options_form in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_views/handlers/ldap_views_handler_argument_attribute.inc \ldap_views_handler_argument_attribute::options_form()
- 7 ldap_views/handlers/ldap_views_handler_argument_attribute.inc \ldap_views_handler_argument_attribute::options_form()
Build the options form.
Overrides views_handler_argument::options_form
File
- ldap_views/
handlers/ ldap_views_handler_argument_attribute.inc, line 25 - Basic textfield argument to handle dynamic ldap attributes.
Class
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,
];
}