You are here

function block_skinr_ui_element_options in Skinr 7.2

Same name and namespace in other branches
  1. 8.2 modules/block.skinr.inc \block_skinr_ui_element_options()

Implements hook_skinr_ui_element_options().

File

modules/block.skinr.inc, line 17
Implements Skinr hooks for block.module.

Code

function block_skinr_ui_element_options($theme_name = NULL) {
  $options = array(
    'block' => array(),
  );
  $themes = list_themes();
  $used_themes = array();
  if ($theme_name) {

    // Only process the given theme.
    $used_themes[] = $theme_name;
  }
  else {

    // Process all enabled themes.
    $options = array();
    foreach ($themes as $theme) {
      if (!$theme->status) {
        continue;
      }
      $used_themes[] = $theme->name;
    }
  }

  // Load all enabled blocks.
  foreach ($used_themes as $theme) {
    $blocks = _block_skinr_load_blocks($theme);
    $theme_title = isset($themes[$theme]->info['name']) ? $themes[$theme]->info['name'] : $theme;
    $theme_key = t('@theme_name blocks', array(
      '@theme_name' => $theme_title,
    ));
    foreach ($blocks as $name => $block) {
      $options['block'][$theme_key][$name] = $block->info;
    }
  }
  return $options;
}