You are here

function multiblock_add in MultiBlock 6

Same name and namespace in other branches
  1. 5 multiblock.module \multiblock_add()
  2. 7 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 201

Code

function multiblock_add($original_block, $block_instance) {

  // Create new delta for block instance.
  $sql = "INSERT INTO {multiblock}\n          (title, module, orig_delta, multi_settings)\n          VALUES ('%s', '%s', '%s', %d)";
  $result = db_query($sql, $block_instance->title, $original_block->module, $original_block->delta, $block_instance->mb_enabled);
  return db_last_insert_id('multiblock', 'delta');
}