Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. BlockPluginTrait.php

function 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\AccessResultInterface The access result.

See also

self::access()

1 call to BlockPluginTrait::blockAccess()
BlockPluginTrait::access in core/lib/Drupal/Core/Block/BlockPluginTrait.php
13 methods override BlockPluginTrait::blockAccess()
AnnounceBlock::blockAccess in core/modules/announcements_feed/src/Plugin/Block/AnnounceBlock.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.
InlineBlock::blockAccess in core/modules/layout_builder/src/Plugin/Block/InlineBlock.php
Indicates whether the block should be shown.

... See full list

File

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

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();
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal