You are here

public function PhotosInformation::access in Album Photos 8.5

Same name and namespace in other branches
  1. 8.4 src/Plugin/Block/PhotosInformation.php \Drupal\photos\Plugin\Block\PhotosInformation::access()
  2. 6.0.x src/Plugin/Block/PhotosInformation.php \Drupal\photos\Plugin\Block\PhotosInformation::access()

Overrides BlockPluginTrait::access

File

src/Plugin/Block/PhotosInformation.php, line 101

Class

PhotosInformation
Provides a 'Photo information' block.

Namespace

Drupal\photos\Plugin\Block

Code

public function access(AccountInterface $account, $return_as_object = FALSE) {

  // Check if user can view photos.
  if ($account
    ->hasPermission('view photo')) {
    $access = AccessResult::allowed();
  }
  else {
    $access = AccessResult::forbidden();
  }
  return $return_as_object ? $access : $access
    ->isAllowed();
}