Problem/Motivation

This is a followup issue for #1535868: Convert all blocks into plugins.

  • node_block_list_alter() could use cleanup and refactoring.
  • It includes legacy code responding to the arguments in the node path in order to hide blocks on the node creation page:
      if (arg(0) == 'node' && arg(1) == 'add' && arg(2)) {
        $node_add_arg = strtr(arg(2), '-', '_');
      }
    ...
          elseif (isset($node_add_arg) && isset($node_types[$node_add_arg])) {
            // This is a node creation page
            if (!isset($block_node_types[$block->module][$block->delta][$node_add_arg])) {
              // This block should not be displayed for this node type.
              unset($blocks[$key]);
              continue;
            }
    
  • It has strange logic with regard to which blocks are excluded from display:
        if (!isset($block->theme) || !isset($block->status) || $block->theme != $theme_key || $block->status != 1) {
          // This block was added by a contrib module, leave it in the list.
          continue;
    

Proposed resolution

  • Clean up node_block_list_alter() if it is not replaced with a visibility plugin.

Comments

xjm’s picture

Issue tags: +Block plugins
xjm’s picture

Status: Postponed » Active
xjm’s picture

Status: Active » Closed (duplicate)

Oops.

xjm’s picture

Issue summary: View changes

Updated issue summary.