function mefibs_get_exposed_items in MEFIBS - More exposed forms in blocks 8
Same name and namespace in other branches
- 7 mefibs.module \mefibs_get_exposed_items()
Retrieve all exposed fields of a given type (filter, sort).
Parameters
object $view: A fully loaded views display object.
string $type: The type of exposed element: 'filter' or 'sort'.
Return value
array Array containing the internal names of exposed elements.
2 calls to mefibs_get_exposed_items()
- mefibs_form_views_ui_edit_display_form_submit in ./
mefibs.module - Submit callback for the views_ui_edit_display form.
- mefibs_get_expected_items_for_exposed_form_block in ./
mefibs.module - Retrieve the elements that should go into the additional form.
File
- ./
mefibs.module, line 318 - Primarily Drupal hooks and global API functions to manipulate views and to provide an additional block with an exposed filter form.
Code
function mefibs_get_exposed_items($display) {
$items = array();
foreach (array(
'sort',
'filter',
) as $type) {
$handlers = $display
->getHandlers($type);
foreach ($handlers as $handler) {
if ($handler->options['exposed'] && in_array($type, array(
'filter',
'sort',
))) {
if ($type == 'filter') {
$items[$type][$handler->options['expose']['identifier']] = $handler->options['id'];
}
else {
$items[$type][] = $handler->options['id'];
}
}
}
}
$pager = $display
->getPlugin('pager');
if ($pager
->usesExposed()) {
if ($pager->options['expose']['items_per_page']) {
$items['other'][] = 'items_per_page';
}
if ($pager->options['expose']['offset']) {
$items['other'][] = 'offset';
}
}
return $items;
}