diff --git a/core/modules/block/block.api.php b/core/modules/block/block.api.php index 93e90df..aa915a3 100644 --- a/core/modules/block/block.api.php +++ b/core/modules/block/block.api.php @@ -48,11 +48,11 @@ function hook_block_view_alter(array &$build, \Drupal\block\BlockPluginInterface * * In this hook name, BASE_BLOCK_ID refers to the block implementation's plugin * id, regardless of whether the plugin supports derivatives. For example, for - * the \Drupal\system\Plugin\block\block\SystemPoweredByBlock block, this would - * be 'system_powered_by_block' as per that class's annotation. And for the - * \Drupal\menu\Plugin\Block\MenuBlock block, it would be 'system_menu_block' as - * per that class's annotation, regardless of which menu the derived block is - * for. + * the \Drupal\system\Plugin\Block\SystemPoweredByBlock block, this would be + * 'system_powered_by_block' as per that class's annotation. And for the + * \Drupal\system\Plugin\Block\SystemMenuBlock block, it would be + * 'system_menu_block' as per that class's annotation, regardless of which menu + * the derived block is for. * * @param array $build * A renderable array of data, as returned from the build() implementation of diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index bca49fc..57f39b6 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -387,6 +387,7 @@ function _menu_parents_recurse($tree, $menu_name, $indent, &$options, $exclude, function menu_block_view_system_menu_block_alter(array &$build, BlockPluginInterface $block) { // Add contextual links for system menu blocks. $menus = menu_list_system_menus(); + // @todo Clean up when http://drupal.org/node/1874498 lands. list(, $menu_name) = explode(':', $block->getPluginId()); if (isset($menus[$menu_name]) && isset($build['content'])) { foreach (element_children($build['content']) as $key) { diff --git a/core/modules/system/lib/Drupal/system/Entity/Menu.php b/core/modules/system/lib/Drupal/system/Entity/Menu.php index 8e295b2..29a838f 100644 --- a/core/modules/system/lib/Drupal/system/Entity/Menu.php +++ b/core/modules/system/lib/Drupal/system/Entity/Menu.php @@ -73,7 +73,8 @@ class Menu extends ConfigEntityBase implements MenuInterface { */ public function getExportProperties() { $properties = parent::getExportProperties(); - // @todo Make $description protected and include it here. + // @todo Make $description protected and include it here, see + // https://drupal.org/node/1301106. $names = array( 'locked', ); diff --git a/core/modules/system/lib/Drupal/system/Plugin/Block/MenuBlock.php b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php similarity index 66% rename from core/modules/system/lib/Drupal/system/Plugin/Block/MenuBlock.php rename to core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php index bd940d9..c6bf324 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Block/MenuBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\system\Plugin\Block\MenuBlock. + * Contains \Drupal\system\Plugin\Block\SystemMenuBlock. */ namespace Drupal\system\Plugin\Block; @@ -18,16 +18,16 @@ * id = "system_menu_block", * admin_label = @Translation("Menu"), * category = "menu", - * derivative = "Drupal\system\Plugin\Derivative\MenuBlock" + * derivative = "Drupal\system\Plugin\Derivative\SystemMenuBlock" * ) */ -class MenuBlock extends BlockBase { +class SystemMenuBlock extends BlockBase { /** * Overrides \Drupal\block\BlockBase::access(). */ public function access() { - // @todo The 'Tools' menu should be available to anonymous users. + // @todo Clean up when http://drupal.org/node/1874498 lands. list( , $derivative) = explode(':', $this->getPluginId()); return ($GLOBALS['user']->isAuthenticated() || in_array($derivative, array('main', 'tools', 'footer'))); } @@ -36,7 +36,8 @@ public function access() { * {@inheritdoc} */ public function build() { - list($plugin, $menu) = explode(':', $this->getPluginId()); + // @todo Clean up when http://drupal.org/node/1874498 lands. + list(, $menu) = explode(':', $this->getPluginId()); return menu_tree($menu); } diff --git a/core/modules/system/lib/Drupal/system/Plugin/Derivative/MenuBlock.php b/core/modules/system/lib/Drupal/system/Plugin/Derivative/SystemMenuBlock.php similarity index 85% rename from core/modules/system/lib/Drupal/system/Plugin/Derivative/MenuBlock.php rename to core/modules/system/lib/Drupal/system/Plugin/Derivative/SystemMenuBlock.php index c005019..5542808 100644 --- a/core/modules/system/lib/Drupal/system/Plugin/Derivative/MenuBlock.php +++ b/core/modules/system/lib/Drupal/system/Plugin/Derivative/SystemMenuBlock.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\system\Plugin\Derivative\MenuBlock. + * Contains \Drupal\system\Plugin\Derivative\SystemMenuBlock. */ namespace Drupal\system\Plugin\Derivative; @@ -15,9 +15,9 @@ /** * Provides block plugin definitions for custom menus. * - * @see \Drupal\system\Plugin\block\block\MenuBlock + * @see \Drupal\system\Plugin\Block\SystemMenuBlock */ -class MenuBlock extends DerivativeBase implements ContainerDerivativeInterface { +class SystemMenuBlock extends DerivativeBase implements ContainerDerivativeInterface { /** * The menu storage. @@ -27,7 +27,7 @@ class MenuBlock extends DerivativeBase implements ContainerDerivativeInterface { protected $menuStorage; /** - * Constructs new MenuBlock. + * Constructs new SystemMenuBlock. * * @param \Drupal\Core\Entity\EntityStorageControllerInterface $menu_storage * The menu storage. diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 4b5afba..39886f4 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -9,7 +9,6 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Language\Language; use Drupal\Core\Utility\ModuleInfo; -use Drupal\system\Plugin\Block\SystemMenuBlock; use Drupal\user\UserInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -2283,6 +2282,7 @@ function system_user_timezone(&$form, &$form_state) { */ function system_preprocess_block(&$variables) { // Derive the base plugin ID. + // @todo Clean up when http://drupal.org/node/1874498 lands. list($plugin_id, $derivative) = explode(':', $variables['plugin_id'] . ':'); switch ($plugin_id) { case 'system_powered_by_block':