You are here

protected function BlockPluginTrait::blockAccess in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Block/BlockPluginTrait.php \Drupal\Core\Block\BlockPluginTrait::blockAccess()

Indicates whether the block should be shown.

Blocks with specific access checking should override this method rather than access(), in order to avoid repeating the handling of the $return_as_object argument.

Parameters

\Drupal\Core\Session\AccountInterface $account: The user session for which to check access.

Return value

\Drupal\Core\Access\AccessResult The access result.

See also

self::access()

2 calls to BlockPluginTrait::blockAccess()
BlockPluginTrait::access in core/lib/Drupal/Core/Block/BlockPluginTrait.php
TestContextAwareBlock::blockAccess in core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php
Indicates whether the block should be shown.
16 methods override BlockPluginTrait::blockAccess()
AggregatorFeedBlock::blockAccess in core/modules/aggregator/src/Plugin/Block/AggregatorFeedBlock.php
Indicates whether the block should be shown.
BlockContentBlock::blockAccess in core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
Indicates whether the block should be shown.
ExtraFieldBlock::blockAccess in core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php
Indicates whether the block should be shown.
FieldBlock::blockAccess in core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
Indicates whether the block should be shown.
ForumBlockBase::blockAccess in core/modules/forum/src/Plugin/Block/ForumBlockBase.php
Indicates whether the block should be shown.

... See full list

File

core/lib/Drupal/Core/Block/BlockPluginTrait.php, line 139

Class

BlockPluginTrait
Provides the base implementation of a block plugin.

Namespace

Drupal\Core\Block

Code

protected function blockAccess(AccountInterface $account) {

  // By default, the block is visible.
  return AccessResult::allowed();
}