You are here

function homebox_layout in Homebox 7.2

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

Form builder function for module settings.

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

File

./homebox.admin.inc, line 365
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
  module_load_include('inc', 'block', 'block.admin');

  // 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');
  $form = drupal_get_form('homebox_admin_display_form', $blocks, $page);
  return drupal_render($form);
}