You are here

function mefibs_sort_block_visible in MEFIBS - More exposed forms in blocks 7

Check if the sort block should be visible in the given context.

The context is defined by the view specific mefibs options and the current display id.

Parameters

string $block_id:

array $mefibs_options:

string $display_id:

Return value

boolean

1 call to mefibs_sort_block_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 1086
Primarily Drupal hooks and global API functions to manipulate views and to provide an additional block with an exposed filter form.

Code

function mefibs_sort_block_visible($block_id, $mefibs_options, $display_id) {
  if (!isset($mefibs_options[$display_id]['sort_block'])) {

    // This is legacy support to not break old configuration.
    return $block_id == 'default';
  }
  $blocks = $mefibs_options[$display_id]['sort_block'];
  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 in_array($block_id, $blocks);
  }
  return FALSE;
}