public function BlockBase::access

Indicates whether block-specific criteria allow access to the block.

Blocks with access restrictions that should always be applied, regardless of user-configured settings, should implement this method with that access control logic.

Return value

bool FALSE to deny access to the block, or TRUE to allow access.

Overrides BlockPluginInterface::access

See also

hook_block_access()

16 methods override BlockBase::access()

File

drupal/core/modules/block/lib/Drupal/block/BlockBase.php, line 97
Contains \Drupal\block\BlockBase.

Class

BlockBase
Defines a base block implementation that most blocks plugins will extend.

Namespace

Drupal\block

Code

public function access() {

  // By default, the block is visible unless user-configured rules indicate
  // that it should be hidden.
  return TRUE;
}