Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedCommitted a fix here:
http://drupalcode.org/project/nodeblock.git/blobdiff/85ffd9e32bce508f36d...
Thanks for spotting this.