A notice error is thrown when creating a new block and leaving the default "current node" option.
Notice: Undefined index: current in Drupal\block_node\Plugin\Block\NodeBlock->__construct() (line 68 of modules/contrib/block_node/src/Plugin/Block/NodeBlock.php)

CommentFileSizeAuthor
#5 block_node-2953285-5.patch1.02 KBtanc
#3 2953285-3.patch650 bytesgrace_kezia

Comments

tanc created an issue. See original summary.

Christopher Riley’s picture

Is this module still being developed? I changed the offending line to if (isset($configuration['current'])) { instead of if ($configuration['current']) { and that took care of the notice but I lost the block because current is set as a 0 so it is always set.

It would be nice for the author to address it or drop the module if it is not going to be developed.

grace_kezia’s picture

Status: Active » Needs review
StatusFileSize
new650 bytes

Hi,
The error is caused because, we are not checking whether current is set or not in the configuration.

Attached is the patch.

justcaldwell’s picture

Status: Needs review » Reviewed & tested by the community

We've been using #3 on a production site for month with no issue. Thank you!

tanc’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.02 KB

This patch fixes it properly and retains the 'current node' option functionality.

  • tanc committed d779b0a on 8.x-1.x
    Issue #2953285 by tanc, grace_kezia: Notice when adding new block
    
tanc’s picture

Status: Needs review » Fixed

Thanks all, committed.

Status: Fixed » Closed (fixed)

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