You are here

public function PhotosRandomImages::access in Album Photos 8.4

Overrides BlockPluginTrait::access

File

src/Plugin/Block/PhotosRandomImages.php, line 25

Class

PhotosRandomImages
Provides a 'Photos random images' 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();
}