You are here

function superfish_array_filter in Superfish 8

Same name and namespace in other branches
  1. 6 superfish.module \superfish_array_filter()
  2. 7 superfish.module \superfish_array_filter()

Helper function to clean up arrays.

3 calls to superfish_array_filter()
SuperfishBlock::build in src/Plugin/Block/SuperfishBlock.php
Implements \Drupal\block\BlockBase::build().
template_preprocess_superfish in ./superfish.theme.inc
Prepares variables for the Superfish menu template.
template_preprocess_superfish_menu_items in ./superfish.theme.inc
Prepares variables for Superfish menu items templates.

File

./superfish.module, line 334
The jQuery Superfish plugin for Drupal menus.

Code

function superfish_array_filter($haystack) {
  foreach ($haystack as $key => $value) {
    if (is_array($value)) {
      $haystack[$key] = superfish_array_filter($haystack[$key]);
    }
    elseif (empty($value) && is_bool($value) !== TRUE) {
      if ($haystack[$key] != '0') {
        unset($haystack[$key]);
      }
    }
  }
  return $haystack;
}