You are here

function rb_block_region_list in Rules Bonus Pack 7

Helper function that builds a select list of all regions in the current theme.

1 string reference to 'rb_block_region_list'
rb_block_rules_action_info in ./rb_block.rules.inc
Implements hook_rules_action_info().

File

./rb_block.rules.inc, line 76
Rules actions to more or disable a Drupal block. Plus some helper functions.

Code

function rb_block_region_list() {

  // Build a list of all available regions in all available themes.
  $regions = array();
  foreach (system_rebuild_theme_data() as $theme_name => $potential_theme) {
    if ($potential_theme->status) {
      foreach ($potential_theme->info['regions'] as $region_name => $region) {

        // The region name is also keyed by its theme, to make it possible to
        // enable blocks on selected themes only. (Yeah, this is a hack to
        // be able to send information about the theme to the action. It should
        // really have its own select list.)
        $regions[$theme_name][$theme_name . '-' . $region_name] = $region;
      }
    }
  }

  // Return the list of available regions.
  return $regions;
}