function mefibs_block_view in MEFIBS - More exposed forms in blocks 7
Implements hook_block_view().
File
- ./
mefibs.module, line 249 - Primarily Drupal hooks and global API functions to manipulate views and to provide an additional block with an exposed filter form.
Code
function mefibs_block_view($delta) {
// If this is 32, this should be an md5 hash.
if (strlen($delta) == 32) {
$hashes = variable_get('mefibs_block_hashes', array());
if (!empty($hashes[$delta])) {
$delta = $hashes[$delta];
}
}
if (strpos($delta, 'mefibs_') === 0) {
$delta = str_replace('mefibs_', '', $delta);
$parts = explode('--', $delta);
if (count($parts) <= 2) {
return;
}
list($view_name, $display_id, $block_id) = $parts;
$view = views_get_view($view_name);
$view
->init_display();
$view
->set_display($display_id);
$view
->init_handlers();
if (!mefibs_display_is_mefibs_enabled($view->display_handler)) {
return;
}
$mefibs_blocks = $view->display_handler->extender['mefibs_blocks']
->get_enabled_blocks();
if (!isset($mefibs_blocks[$block_id])) {
return;
}
$elements = mefibs_get_expected_items_for_exposed_form_block($view, $block_id);
if (count($elements, COUNT_RECURSIVE) > 3) {
$form = mefibs_exposed_block_form($view, $block_id);
views_add_contextual_links($form, 'special_block_-exp', $view, $display_id);
return array(
'content' => $form,
);
}
}
}