You are here

public function Access::access in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  2. 8.2 modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  3. 8.3 modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  4. 8.4 modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  5. 8.5 modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  6. 8.6 modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  7. 8.7 modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  8. 8.8 modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  9. 10.3.x modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  10. 10.0.x modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  11. 10.1.x modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()
  12. 10.2.x modules/custom/social_language/src/Access.php \Drupal\social_language\Access::access()

Checks access to the overview based on permissions and translatability.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route_match to check against.

\Drupal\Core\Session\AccountInterface $account: The account to check access for.

string $permission: (optional) The permission.

File

modules/custom/social_language/src/Access.php, line 45

Class

Access
Class Access.

Namespace

Drupal\social_language

Code

public function access(RouteMatchInterface $route_match, AccountInterface $account, $permission = NULL) {
  if (count($this->languageManager
    ->getLanguages()) > 1) {
    if (!empty($permission)) {
      return AccessResult::allowedIfHasPermission($account, $permission);
    }
    else {
      return AccessResult::allowed();
    }
  }
  return AccessResult::forbidden();
}