You are here

function homebox_layout in Homebox 6.2

Same name and namespace in other branches
  1. 6.3 homebox.admin.inc \homebox_layout()
  2. 6 homebox.admin.inc \homebox_layout()
  3. 7.3 homebox.admin.inc \homebox_layout()
  4. 7.2 homebox.admin.inc \homebox_layout()

Form builder function for module settings.

1 string reference to 'homebox_layout'
homebox_menu in ./homebox.module
Implementation of hook_menu().

File

./homebox.admin.inc, line 347
Homebox admin file, takes care admin interface for homebox

Code

function homebox_layout($page) {
  drupal_set_title(t('!page_name layout', array(
    '!page_name' => $page->settings['title'],
  )));

  // Gets admin build block helper for usort function
  require_once drupal_get_path('module', 'block') . '/block.admin.inc';

  // Fetch and sort blocks
  $blocks = _block_rehash();
  $home_blocks = $page->settings['blocks'];
  foreach ($blocks as $key => &$block) {

    // We don't want to list exposed views blocks
    if (strpos($block['delta'], '-exp-') === 0) {

      // Remove exposed views blocks
      unset($blocks[$key]);
      continue;
    }

    // Generate identified for current block
    $id = $block['module'] . '_' . $block['delta'];

    // Check if current block has settings
    if (isset($home_blocks[$id])) {
      $hb = $home_blocks[$id];
      $block['weight'] = $hb['weight'];
      $block['movable'] = (bool) $hb['movable'];
      $block['status'] = (bool) $hb['status'];
      $block['open'] = (bool) $hb['open'];
      $block['closable'] = (bool) $hb['closable'];
      $block['title'] = $hb['title'];
    }
    else {
      $block['weight'] = 99;
      $block['movable'] = TRUE;
      $block['status'] = TRUE;
      $block['open'] = TRUE;
      $block['closable'] = TRUE;
    }
  }
  usort($blocks, '_homebox_block_compare');
  return drupal_get_form('homebox_admin_display_form', $blocks, $page, $theme = NULL);
}