You are here

function mefibs_item_visible in MEFIBS - More exposed forms in blocks 7

Check if the given item should be visible in the given context.

The context is defined by the view specific mefibs options, the current display id, the item type (filter, other) and the item name itself.

Parameters

string $block_id:

array $mefibs_options:

string $display_id:

string $type:

string $item:

Return value

boolean

1 call to mefibs_item_visible()
mefibs_get_expected_items_for_exposed_form_block in ./mefibs.module
Retrieve the elements that should go into an additional form.

File

./mefibs.module, line 1058
Primarily Drupal hooks and global API functions to manipulate views and to provide an additional block with an exposed filter form.

Code

function mefibs_item_visible($block_id, $mefibs_options, $display_id, $type, $item) {
  if (!isset($mefibs_options[$display_id][$type][$item])) {

    // This is legacy support to not break old configuration.
    return $block_id == 'default';
  }
  $blocks = $mefibs_options[$display_id][$type][$item];
  if (is_string($blocks)) {

    // This is legacy support to not break old configuration.
    return $blocks == $block_id;
  }
  if (is_array($blocks)) {

    // This is the new expected form of the configuration.
    return count($blocks) ? in_array($block_id, $blocks, TRUE) : FALSE;
  }
  return FALSE;
}