public function content_menu_language_filter::addFilterWidget in Content Menu 8
Same name and namespace in other branches
- 7 filters/content_menu_language_filter.php \content_menu_language_filter::addFilterWidget()
@abstract
_state _id
Parameters
$form:
Return value
add the filter widget, to display the filter on top its recommended to add $form['#content_menu_filter_widget'][] = 'name_of_filter_widget'; otherwise the filter will be displayed as child after the table
Overrides content_menu_filter::addFilterWidget
File
- filters/
content_menu_language_filter.php, line 22
Class
Code
public function addFilterWidget(&$form, &$form_state, $form_id) {
if ($this->active) {
$options = array(
'' => t('-- Current (@lang) --', array(
'@lang' => t($GLOBALS['language']->name),
)),
'all' => t('-- All --'),
);
foreach (language_list() as $key => $lang) {
$options[$key] = t($lang->name);
}
$form['langselect'] = array(
'#type' => 'select',
'#title' => t('Filter menu by language'),
'#options' => $options,
'#default_value' => $this->language,
// @todo Remove ctools dependency as ajax is actually not used.
// Refactor to use own form and submit handler instead.
'#ajax' => array(
'callback' => '_content_menu_filter_elements_by_language',
),
);
$form['#content_menu_filter_widget'][] = 'langselect';
}
}