You are here

protected function DsTestBlock::blockAccess in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 tests/modules/ds_test/src/Plugin/Block/DsTestBlock.php \Drupal\ds_test\Plugin\Block\DsTestBlock::blockAccess()
  2. 8.3 tests/modules/ds_test/src/Plugin/Block/DsTestBlock.php \Drupal\ds_test\Plugin\Block\DsTestBlock::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.

Overrides BlockPluginTrait::blockAccess

See also

self::access()

File

tests/modules/ds_test/src/Plugin/Block/DsTestBlock.php, line 25

Class

DsTestBlock
Defines a Display suite test block.

Namespace

Drupal\ds_test\Plugin\Block

Code

protected function blockAccess(AccountInterface $account) {
  return AccessResult::allowedIf(\Drupal::state()
    ->get('ds_test_block__access', FALSE));
}