Posted by xjm

Problem/Motivation

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

  • hook_block_view_ID_alter() and hook_block_view_NAME_alter() currently have the same documented example in block.api.php.
  • It is unclear from the documentation what ID and NAME represent.

Proposed resolution

  • Improve the documentation to clarify the different uses of the two hooks.
  • Provide differing, plausible example implementations for each.
  • Consider renaming the hooks to use more explicit tokens than ID and NAME.
  • Include example hook names in the documentation.

Comments

xjm’s picture

Issue tags: +Blocks-Layouts
xjm’s picture

Status: Postponed » Active
xjm’s picture

Issue tags: +Block plugins
xjm’s picture

jhodgdon’s picture

See also #1892472-8: Document hook_block_access -- apparently some of the parameters in these functions are using the wrong class names?

jibran’s picture

Issue tags: +Novice

Tagging

pieterjd’s picture

Status: Active » Closed (works as designed)

After reviewing the block.api.php file, it turned out that hook_block_view_ID_alter() and hook_block_view_NAME_alter() functions were removed and hook_block_view_BASE_BLOCK_ID_alter was added.

The documentation of hook_block_view_BASE_BLOCK_ID_alter includes two examples and clearly states that BASE_BLOCK_ID refers to the block implementation's plugin id and not the block name.

This is my first contribution ever during Drupalcon Prague's "get involved in core" workshop.

pieterjd’s picture

Issue summary: View changes

Removing myself from the author field so that I can unfollow the issue. --xjm