You are here

function multiblock_add in MultiBlock 7

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

Add a multiblock instance.

Parameters

$original_block: The original block for which an instance is being created.

$block_instance: An object contain information about the particular block instance.

Return value

The delta of the newly added block.

1 call to multiblock_add()
multiblock_add_form_submit in ./multiblock.module
Add block instance to database from "Add Block Instance" form.

File

./multiblock.module, line 269
Enhances the block API, as provided by D7 Core.

Code

function multiblock_add($original_block, $block_instance) {

  // Create new delta for block instance.
  $record = array(
    'title' => $block_instance->title,
    'module' => $original_block->module,
    'orig_delta' => $original_block->delta,
    'multi_settings' => $block_instance->mb_enabled,
  );
  drupal_write_record('multiblock', $record);
  return $record['delta'];
}