weight_handler_filter_weight_enabled.inc in Weight 7.2
File
views/weight_handler_filter_weight_enabled.inc
View source
<?php
class weight_handler_filter_weight_enabled extends views_handler_filter {
function value_form(&$form, &$form_state) {
if (empty($this->value_options)) {
$this
->get_value_options();
}
if (!empty($form_state['exposed'])) {
$filter_form_type = 'select';
}
else {
$filter_form_type = 'radios';
}
$form['value'] = array(
'#type' => $filter_form_type,
'#title' => t('Enabled'),
'#options' => $this->value_options,
'#default_value' => $this->value,
);
if (!empty($this->options['exposed'])) {
$identifier = $this->options['expose']['identifier'];
if (!empty($form_state['exposed']) && !isset($form_state['input'][$identifier])) {
$form_state['input'][$identifier] = $this->value;
}
}
}
function get_value_options() {
$this->value_options = array(
1 => t('Yes'),
0 => t('No'),
);
}
function show_value_form(&$form, &$form_state) {
$this
->value_form($form, $form_state);
}
function admin_summary() {
if (!empty($this->options['exposed'])) {
return t('exposed');
}
if (empty($this->value_options)) {
$this
->get_value_options();
}
return $this->value_options[!empty($this->value)];
}
}