You are here

function multiblock_general in MultiBlock 5

Same name and namespace in other branches
  1. 6 multiblock.module \multiblock_general()
  2. 7 multiblock.module \multiblock_general()

Page callback for the "Manage Block Instances page".

1 string reference to 'multiblock_general'
multiblock_menu in ./multiblock.module
Implementation of hook_menu().

File

./multiblock.module, line 96

Code

function multiblock_general() {
  if (func_num_args() && func_get_arg(0) == 'edit' && is_numeric($instance = func_get_arg(1))) {
    $req_block = multiblock_get_block($instance);
  }

  // Fetch blocks directly from modules using block.module function.
  $blocks = _block_rehash();

  // Sort blocks how we want them.
  usort($blocks, 'multiblock_block_sort');

  // Fetch "Add Instance" form.
  if (isset($req_block)) {
    $form = drupal_get_form('multiblock_add_form', $blocks, $req_block);
  }
  else {
    $form = drupal_get_form('multiblock_add_form', $blocks);
  }

  // Get an array of existing blocks.
  $multiblocks = multiblock_get_block(NULL, TRUE);
  return theme('multiblock_general', $form, $multiblocks, isset($req_block));
}