You are here

function homebox_list_available_blocks in Homebox 6

List available blocks to let user show/hide blocks

Parameters

$regions: contains every regions/blocks

Return value

An array of blocks containing information like subject/dom_id/status/checked

1 call to homebox_list_available_blocks()
homebox_build in ./homebox.module
Responsible for firing the hook_theme()

File

./homebox.module, line 421
Home box main file, takes care of global functions settings constants, etc.

Code

function homebox_list_available_blocks($regions) {
  $blocks = array();
  $i = 0;
  foreach ($regions as $column) {
    foreach ($column as $weight) {
      foreach ($weight as $block) {

        // Block created with Views, check access
        if ($block->module == 'views' && !_homebox_check_views_block_access($block)) {
          continue;
        }
        $blocks[$i]['subject'] = $block->subject;
        $blocks[$i]['dom_id'] = 'homebox-block-' . $block->module . '-' . $block->delta;
        $blocks[$i]['status'] = $block->status;
        $blocks[$i]['checked'] = $block->status ? 'checked="checked"' : NULL;
        $i++;
      }
    }
  }

  // Sorts blocks by subject in alpha order asc
  usort($blocks, '_homebox_compare_block_subject');
  return $blocks;
}