diff --git a/core/modules/block/block.api.php b/core/modules/block/block.api.php index 14d226b..3d3c4d1 100644 --- a/core/modules/block/block.api.php +++ b/core/modules/block/block.api.php @@ -13,11 +13,12 @@ /** * Perform alterations to the content of a block entity. * - * This hook allows you to modify any data returned by hook_block_view(). + * This hook allows you to modify any data returned by + * \Drupal\block\BlockRenderController::view(). * - * Note that instead of hook_block_view_alter(), which is called for all - * blocks, you can also use hook_block_view_ID_alter() to alter a specific - * block, or hook_block_plugin_view_NAME_alter() to alter a specific block + * Note that instead of hook_block_wrapper_view_alter(), which is called for all + * blocks, you can also use hook_block_wrapper_view_ID_alter() to alter a specific + * block, or hook_block_view_NAME_alter() to alter a specific block * instance. * * @param array $build @@ -27,10 +28,10 @@ * @param \Drupal\block\Plugin\Core\Entity\Block $block * The block entity. * - * @see hook_block_view_ID_alter() - * @see hook_block_plugin_view_NAME_alter() + * @see hook_block_wrapper_view_ID_alter() + * @see hook_block_view_NAME_alter() */ -function hook_block_view_alter(array &$build, \Drupal\block\Plugin\Core\Entity\Block $block) { +function hook_block_wrapper_view_alter(array &$build, \Drupal\block\Plugin\Core\Entity\Block $block) { // Remove the contextual links on all blocks that provide them. if (is_array($build) && isset($build['#contextual_links'])) { unset($build['#contextual_links']); @@ -45,8 +46,8 @@ function hook_block_view_alter(array &$build, \Drupal\block\Plugin\Core\Entity\B /** * Perform alterations to the content of a specific block entity. * - * Modules can implement hook_block_view_ID_alter() to modify a specific block - * entity, rather than implementing hook_block_view_alter(). + * Modules can implement hook_block_wrapper_view_ID_alter() to modify a specific block + * entity, rather than implementing hook_block_wrapper_view_alter(). * * @param array $build * A renderable array of data, as returned from the build() implementation of @@ -56,12 +57,12 @@ function hook_block_view_alter(array &$build, \Drupal\block\Plugin\Core\Entity\B * The block entity. * * @todo Add a more specific example of a block ID, and illustrate how this is - * different from hook_block_plugin_view_NAME_alter(). + * different from hook_block_view_NAME_alter(). * - * @see hook_block_view_alter() - * @see hook_block_plugin_view_NAME_alter() + * @see hook_block_wrapper_view_alter() + * @see hook_block_view_NAME_alter() */ -function hook_block_view_ID_alter(array &$build, \Drupal\block\Plugin\Core\Entity\Block $block) { +function hook_block_wrapper_view_ID_alter(array &$build, \Drupal\block\Plugin\Core\Entity\Block $block) { // This code will only run for a specific block. For example, if ID // in the function definition above is set to "someid", the code // will only run on the "someid" block. @@ -78,7 +79,7 @@ function hook_block_view_ID_alter(array &$build, \Drupal\block\Plugin\Core\Entit * @param \Drupal\block\BlockInterface $block * The block plugin. */ -function hook_block_plugin_view_alter(array &$build, \Drupal\block\BlockInterface $block) { +function hook_block_view_alter(array &$build, \Drupal\block\BlockInterface $block) { if (isset($build['#content'])) { foreach (element_children($build['#content']) as $key) { $build['#content']['#contextual_links']['my_module'] = array('admin/structure/mymodule', array($build['#content'][$key]['some_value'])); @@ -89,9 +90,9 @@ function hook_block_plugin_view_alter(array &$build, \Drupal\block\BlockInterfac /** * Perform alterations to the content of a specific block plugin. * - * Modules can implement hook_block_plugin_view_NAME_alter() to modify a + * Modules can implement hook_block_view_NAME_alter() to modify a * specific block plugin, rather than implementing - * hook_block_plugin_view_alter(). + * hook_block_view_alter(). * * @param array $build * A renderable array of data, as returned from the build() implementation of @@ -102,13 +103,13 @@ function hook_block_plugin_view_alter(array &$build, \Drupal\block\BlockInterfac * * @todo NAME is ambiguous, and so is the example here. Use a more specific * example to illustrate what the block instance name will look like, and - * also illustrate how it is different from hook_block_view_ID(). + * also illustrate how it is different from hook_block_wrapper_view_ID(). * - * @see hook_block_plugin_view_alter() * @see hook_block_view_alter() - * @see hook_block_view_ID_alter() + * @see hook_block_wrapper_view_alter() + * @see hook_block_wrapper_view_ID_alter() */ -function hook_block_plugin_view_NAME_alter(array &$build, \Drupal\block\BlockInterface $block) { +function hook_block_view_NAME_alter(array &$build, \Drupal\block\BlockInterface $block) { // This code will only run for a specific block instance. For example, if NAME // in the function definition above is set to "someid", the code will only run // on the "someid" block. diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index 81fed98..f1c41cb 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -465,7 +465,7 @@ public function build() { ); } list($name) = explode(':', $plugin_id . ':'); - drupal_alter(array('block_plugin_view', "block_plugin_view_$name"), $build, $this); + drupal_alter(array('block_view', "block_view_$name"), $build, $this); return $build; } diff --git a/core/modules/block/lib/Drupal/block/BlockRenderController.php b/core/modules/block/lib/Drupal/block/BlockRenderController.php index 4e206aa..73cc4cd 100644 --- a/core/modules/block/lib/Drupal/block/BlockRenderController.php +++ b/core/modules/block/lib/Drupal/block/BlockRenderController.php @@ -46,7 +46,7 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la // All blocks, even when empty, should be available for altering. list(, $name) = $entity->id(); - drupal_alter(array('block_view', "block_view_$name"), $build[$entity_id], $plugin); + drupal_alter(array('block_wrapper_view', "block_wrapper_view_$name"), $build[$entity_id], $plugin); } return $build; diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index f9c7a37..9e37290 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -637,7 +637,8 @@ function forum_form_node_form_alter(&$form, &$form_state, $form_id) { * * This function can be used as a #pre_render callback. * - * @see forum_block_view() + * @see \Drupal\forum\Plugin\block\block\NewTopicsBlock::blockBuild() + * @see \Drupal\forum\Plugin\block\block\ActiveTopicsBlock::blockBuild() */ function forum_block_view_pre_render($elements) { $result = $elements['#query']->execute(); diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 99f43fc..a02b7dd 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -408,9 +408,9 @@ function _menu_parents_recurse($tree, $menu_name, $indent, &$options, $exclude, } /** - * Implements hook_block_plugin_view_NAME_alter() for 'system_menu_block'. + * Implements hook_block_view_NAME_alter() for 'system_menu_block'. */ -function menu_block_plugin_view_system_menu_block_alter(array &$build, BlockInterface $block) { +function menu_block_view_system_menu_block_alter(array &$build, BlockInterface $block) { // Add contextual links for system menu blocks. if (isset($build['#content'])) { foreach (element_children($build['#content']) as $key) { diff --git a/core/modules/openid/openid.module b/core/modules/openid/openid.module index ac1421c..d4241db 100644 --- a/core/modules/openid/openid.module +++ b/core/modules/openid/openid.module @@ -160,13 +160,13 @@ function openid_user_logout($account) { } /** - * Implements hook_block_plugin_view_NAME_alter() for 'user_login_block'. + * Implements hook_block_view_NAME_alter() for 'user_login_block'. * * Adds the OpenID login form to the user login block. * * @see \Drupal\user\Plugin\block\block\UserLoginBlock */ -function openid_block_plugin_view_user_login_block_alter(array &$build, BlockInterface $block) { +function openid_block_view_user_login_block_alter(array &$build, BlockInterface $block) { // Only alter the block when it is non-empty, i.e. when no user is logged in. if (!isset($build['#content']['user_login_form'])) { return; diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 3bc0bd1..9b598e0 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -560,7 +560,7 @@ function views_contextual_links_view_alter(&$element, $items) { * @param $display_id * The ID of the display within $view whose contextual links will be added. * - * @see views_block_view() + * @see \Drupal\views\Plugin\block\block\ViewsBlock::addContextualLinks() * @see views_page_alter() * @see template_preprocess_views_view() */