function ldap_views_handler_filter::value_form in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_views/handlers/ldap_views_handler_filter.inc \ldap_views_handler_filter::value_form()
- 7 ldap_views/handlers/ldap_views_handler_filter.inc \ldap_views_handler_filter::value_form()
Provide a simple textfield for equality
1 call to ldap_views_handler_filter::value_form()
- ldap_views_handler_filter_attribute::value_form in ldap_views/
handlers/ ldap_views_handler_filter_attribute.inc - Provide a simple textfield for equality
1 method overrides ldap_views_handler_filter::value_form()
- ldap_views_handler_filter_attribute::value_form in ldap_views/
handlers/ ldap_views_handler_filter_attribute.inc - Provide a simple textfield for equality
File
- ldap_views/
handlers/ ldap_views_handler_filter.inc, line 132 - Basic textfield filter to handle string filtering commands including equality, contains, not contains, etc.
Class
- ldap_views_handler_filter
- @file Basic textfield filter to handle string filtering commands including equality, contains, not contains, etc.
Code
function value_form(&$form, &$form_state) {
// We have to make some choices when creating this as an exposed
// filter form. For example, if the operator is locked and thus
// not rendered, we can't render dependencies; instead we only
// render the form items we need.
$which = 'all';
if (!empty($form['operator'])) {
$source = $form['operator']['#type'] == 'radios' ? 'radio:options[operator]' : 'edit-options-operator';
}
if (!empty($form_state['exposed'])) {
$identifier = $this->options['expose']['identifier'];
if (empty($this->options['expose']['use_operator']) || empty($this->options['expose']['operator_id'])) {
// exposed and locked.
$which = in_array($this->operator, $this
->operator_values(1)) ? 'value' : 'none';
}
else {
$source = 'edit-' . drupal_html_id($this->options['expose']['operator_id']);
}
}
if ($which == 'all' || $which == 'value') {
$form['value'] = array(
'#type' => 'textfield',
'#title' => t('Value'),
'#size' => 30,
'#default_value' => $this->value,
);
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
$form_state['input'][$identifier] = $this->value;
}
if ($which == 'all') {
$form['value'] += array(
'#dependency' => array(
$source => $this
->operator_values(1),
),
);
}
}
if (!isset($form['value'])) {
// Ensure there is something in the 'value'.
$form['value'] = array(
'#type' => 'value',
'#value' => NULL,
);
}
}