Notice: Undefined index: blocks in node_level_blocks_node_save_blocks() (regel 102 van ../sites/sitename/modules/contrib/node_level_blocks/node_level_blocks.module).
Warning: Invalid argument supplied for foreach() in node_level_blocks_node_save_blocks() (regel 109 van ../sites/sitename/modules/contrib/node_level_blocks/node_level_blocks.module).

The function node_level_blocks_node_save_blocks does not check whether NLB is enabled or not.

Comments

spadxiii’s picture

Status: Active » Needs review
StatusFileSize
new557 bytes

Johnny vd Laar’s picture

Status: Needs review » Fixed

Commited your patch:
http://cgit.drupalcode.org/node_level_blocks/commit/?id=dc3b28c

Thanks for the help!

mrharolda’s picture

Status: Fixed » Needs work

The settings->enabled check in node_level_blocks_node_save_blocks() requires that the settings are available in $node->node_level_blocks, which they aren't.

Adding this snippet in node_level_blocks_node_form() fixes that:

  $form['node_level_blocks']['settings'] = array(
    '#type' => 'value',
    '#value' => $settings,
  );
rudiedirkx’s picture

Status: Needs work » Needs review

Damnit, Johnny, sometimes you have to try it out before committing!

Settings are irrelevant. If $node->node_level_blocks['blocks'] exist, it's fine. It's the same check that happens a few lines later to check in $node->original.

Patch is against dev.

rudiedirkx’s picture

StatusFileSize
new492 bytes

Patch is against dev.

rudiedirkx’s picture

These patches are against 2.0-alpha1, including and excluding fix from #2495761: Blocks from LANGUAGE_NONE are always shown. Busy month.

  • Johnny vd Laar committed 97c1c6d on 7.x-2.x
    Issue #2503825 by rudiedirkx, SpadXIII, Johnny vd Laar: Notice while...
Johnny vd Laar’s picture

Status: Needs review » Fixed

Your fix wasn't sufficient because when NLB is disabled for a CT it will still submit node_level_blocks['blocks']. The form should also submit the settings to make the $node->node_level_blocks array the same as after a node_load. Therefore I've added a value element in the form.

http://cgit.drupalcode.org/node_level_blocks/commit/?id=97c1c6d

I also fixed the node preview button.

Status: Fixed » Closed (fixed)

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

rudiedirkx’s picture

when NLB is disabled for a CT it will still submit node_level_blocks['blocks']

That was intentional. A node_save() does the same. Enabledness is irrelevant. If a node has NLB blocks, they will be saved, period. I think that's the correct way, but you're the boss.