You are here

protected function ProfileStatisticBlock::blockAccess in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_profile/src/Plugin/Block/ProfileStatisticBlock.php \Drupal\social_profile\Plugin\Block\ProfileStatisticBlock::blockAccess()
  2. 8.8 modules/social_features/social_profile/src/Plugin/Block/ProfileStatisticBlock.php \Drupal\social_profile\Plugin\Block\ProfileStatisticBlock::blockAccess()
  3. 10.0.x modules/social_features/social_profile/src/Plugin/Block/ProfileStatisticBlock.php \Drupal\social_profile\Plugin\Block\ProfileStatisticBlock::blockAccess()
  4. 10.1.x modules/social_features/social_profile/src/Plugin/Block/ProfileStatisticBlock.php \Drupal\social_profile\Plugin\Block\ProfileStatisticBlock::blockAccess()
  5. 10.2.x modules/social_features/social_profile/src/Plugin/Block/ProfileStatisticBlock.php \Drupal\social_profile\Plugin\Block\ProfileStatisticBlock::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

modules/social_features/social_profile/src/Plugin/Block/ProfileStatisticBlock.php, line 109

Class

ProfileStatisticBlock
Provides a 'ProfileStatisticBlock' block.

Namespace

Drupal\social_profile\Plugin\Block

Code

protected function blockAccess(AccountInterface $account) {

  // Show statistic block only when new style is enabled.
  if (theme_get_setting('style') === 'sky') {
    return AccessResult::allowed();
  }
  return AccessResult::forbidden();
}