diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index f1217c0..d27d41a 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -11,6 +11,7 @@ use Drupal\block\BlockInterface; use Drupal\Component\Utility\Unicode; use Drupal\Core\Language\Language; +use Drupal\user\Plugin\Core\Entity\User; /** * Defines a base block implementation that most blocks plugins will extend. @@ -75,7 +76,7 @@ public function setConfigurationValue($key, $value) { /** * {@inheritdoc} */ - public function access() { + public function access(User $user = null) { // By default, the block is visible unless user-configured rules indicate // that it should be hidden. return TRUE; diff --git a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php index 5f353a4..9df84c8 100644 --- a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php +++ b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php @@ -10,6 +10,7 @@ use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\Component\Plugin\ConfigurablePluginInterface; use Drupal\Core\Plugin\PluginFormInterface; +use Drupal\user\Plugin\Core\Entity\User; /** * Defines the required interface for all block plugins. @@ -38,13 +39,15 @@ public function settings(); * * This method allows base implementations to add general access restrictions * that should apply to all extending block plugins. - * + * + * @param \Drupal\user\Plugin\Core\Entity\User $user + * (optional) User entity to check access for. * @return bool * TRUE if the block should be shown, or FALSE otherwise. * * @see \Drupal\block\BlockAccessController */ - public function access(); + public function access(User $user = NULL); /** * Builds and returns the renderable array for this block plugin.