Hi,

I get an error when I'm editing a block in the block admin. The problem is the missing "comment_link" index in the "edit" array.

/**
 * Implements hook_block_save().
 */
function nodeblock_block_save($delta = '', $edit = array()) {
  db_update('nodeblock')
    ->condition('machine_name', $delta)
    ->fields(array('view_mode' => $edit['view_mode'], 'node_link' => $edit['node_link'], 'comment_link' => $edit['comment_link']))
    ->execute();
}

Should be:

/**
 * Implements hook_block_save().
 */
function nodeblock_block_save($delta = '', $edit = array()) {
	$values = array(
		'view_mode' => $edit['view_mode'], 
		'node_link' => $edit['node_link']
	);

	if (isset($edit['comment_link'])) {
		$values['comment_link'] = $edit['comment_link'];
	}
	
  	db_update('nodeblock')
    	->condition('machine_name', $delta)
    	->fields($values)
    	->execute();
}

Comments

Johnny vd Laar’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.