You are here

function mefibs_remove_block_association_recursive in MEFIBS - More exposed forms in blocks 7

Recursively remove block associations from mefibs settings.

Parameters

array $display_settings: A structure like: 'filter' => array( 'filter_name' => array( 1 => block_id_1 2 => block_id_2 ), ), 'sort_block => array( 0 => block_id_1, ), 'other' => array( 'items_per_page' => array( 1 => block_id_1, ), 'offset' => array( 1 => block_id_1, ), )

array $block_ids: The blocks to preserve.

1 call to mefibs_remove_block_association_recursive()
mefibs_display_extender_plugin_blocks::options_submit in ./mefibs_display_extender_plugin_blocks.inc
Handle any special handling on the form submission.

File

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

Code

function mefibs_remove_block_association_recursive(&$display_settings, $block_ids) {
  if (!is_array($display_settings) || !count($display_settings)) {
    return;
  }
  foreach ($display_settings as $key => $value) {
    if (is_array($value)) {
      mefibs_remove_block_association_recursive($display_settings[$key], $block_ids);
      continue;
    }
    if (!in_array($value, $block_ids)) {
      unset($display_settings[$key]);
    }
  }
}