You are here

public function PmAddBlock::blockAccess in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  2. 8 modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  3. 8.2 modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  4. 8.3 modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  5. 8.4 modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  6. 8.5 modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  7. 8.6 modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  8. 8.7 modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  9. 8.8 modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  10. 10.0.x modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  11. 10.1.x modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()
  12. 10.2.x modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php \Drupal\social_private_message\Plugin\Block\PmAddBlock::blockAccess()

Custom access logic to display the block.

Overrides BlockPluginTrait::blockAccess

File

modules/social_features/social_private_message/src/Plugin/Block/PmAddBlock.php, line 26

Class

PmAddBlock
Provides a 'PmAddBlock' block.

Namespace

Drupal\social_private_message\Plugin\Block

Code

public function blockAccess(AccountInterface $account) {
  if ($account
    ->hasPermission('use private messaging system') && $account
    ->hasPermission('create private messages thread')) {
    return AccessResult::allowed();
  }
  return AccessResult::forbidden();
}