Problem/Motivation

This is a followup issue for #1535868: Convert all blocks into plugins and #1874498: Provide and use API methods for retrieving base plugin and derivative names from block plugin IDs.

block_help() has some legacy use of arg() for displaying help text for demonstrating regions on the block admin page, especially following #1535868: Convert all blocks into plugins:

  if ($arg[0] == 'admin' && $arg[1] == 'structure' && $arg['2'] == 'block' && (empty($arg[3]) || $arg[3] == 'list') && empty($arg[5])) {
    if (!empty($arg[4])) {
      list(, $demo_theme) = explode(':', $arg[4]);
    }
    else {
      $demo_theme = variable_get('theme_default', 'stark');
    }

Proposed resolution

Use menu API functions and the new method provided in #1874498: Provide and use API methods for retrieving base plugin and derivative names from block plugin IDs to make this function cleaner.

Comments

xjm’s picture

Category: task » bug

The hardcoded argument parsing also results in notices when deleting a block instance. Steps to reproduce:

  1. Go to admin/structure/block.
  2. Select the delete operation for any block and confirm.
  3. You will be redirected to (e.g.) admin/structure/block/list/bartik with the notices:
    Notice: Undefined offset: 1 in block_help() (line 67 of core/modules/block/block.module).
    Notice: Undefined index: in block_help() (line 74 of core/modules/block/block.module).
    Notice: Trying to get property of non-object in block_help() (line 74 of core/modules/block/block.module).
    

    The theme demo link also will not work.

Related issues:

xjm’s picture

Status: Postponed » Active
xjm’s picture

Issue tags: +Block plugins
jibran’s picture

Category: bug » task

It works fine for me. I am unable to reproduce #1. So setting back to task for clean up.

jhodgdon’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

This issue is obsolete.