function group_filters_form in Group 7
Builds the group overview filters.
1 call to group_filters_form()
- GroupUIController::overviewForm in classes/
group.ui_controller.inc - Builds the group overview form.
File
- admin/
group.inc, line 13 - Group overview admin UI.
Code
function group_filters_form() {
$filters = module_invoke_all('group_filters');
$session = isset($_SESSION['group_overview_filters']) ? $_SESSION['group_overview_filters'] : array();
$i = 0;
$fs_filters = array(
'#type' => 'fieldset',
'#title' => t('Show only groups where'),
'#theme' => 'exposed_filters__group',
);
// Loop through session saved filters.
foreach ($session as $type => $value) {
$value = $filters[$type]['options'][$value];
$t_args = array(
'%property' => $filters[$type]['title'],
'%value' => $value,
);
$fs_filters['current'][] = $i++ ? array(
'#markup' => t('and where %property is %value', $t_args),
) : array(
'#markup' => t('where %property is %value', $t_args),
);
// Remove the option if it is already being filtered on.
unset($filters[$type]);
}
if (count($filters)) {
$fs_filters['status'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'clearfix',
),
),
'#prefix' => $i ? '<div class="additional-filters">' . t('and where') . '</div>' : '',
);
}
$fs_filters['status']['filters'] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'filters',
),
),
);
foreach ($filters as $key => $filter) {
$fs_filters['status']['filters'][$key] = array(
'#type' => 'select',
'#options' => $filter['options'],
'#title' => $filter['title'],
'#default_value' => '[any]',
);
}
$fs_filters['status']['actions'] = array(
'#type' => 'actions',
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
if (count($filters)) {
$fs_filters['status']['actions']['submit'] = array(
'#type' => 'submit',
'#value' => count($session) ? t('Refine') : t('Filter'),
);
}
if (count($session)) {
$fs_filters['status']['actions']['undo'] = array(
'#type' => 'submit',
'#value' => t('Undo'),
);
$fs_filters['status']['actions']['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset'),
);
}
return $fs_filters;
}