If a block is enabled for insertion, and its region is changed inside its configuration form, it is possible that the block will be configured to be inserted into a block in another region.

When this happens, there should be a validation error telling the user that the target block is required if the block is enabled for insertion.

Comments

runswithscissors created an issue. See original summary.

Ben Greenberg’s picture

Status: Active » Patch (to be ported)
StatusFileSize
new28.31 KB

Added patch

Handling the change in region meant having to alter the structure of the array saved in the target_blocks column of the block_in_block table. For example:

'bartik' => array(
  'regions' => array( <-- ADDED
    'content' => array( <-- ADDED: 'content' IS REGION NAME
      'block_key' => 'system_main',
      'node_types' => array(
        'article' => array(
          'view_modes' => array(
            'full' => 'full',
            'teaser' => 0,
          ),
        ),
      ),
    ),  
  ),
)

The patch includes a hook_update_N function to update the data in every existing record's target_blocks column to the new structure.

  • runswithscissors committed e9c7a1c on 7.x-1.x
    Issue #3096706: Handle a change to the block's region in config form
    
Ben Greenberg’s picture

Status: Patch (to be ported) » Fixed
Ben Greenberg’s picture

Status: Fixed » Closed (fixed)