You are here

public function SocialCoreController::accessDenied in Open Social 10.3.x

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

Custom function for returning markup on the access denied page.

1 string reference to 'SocialCoreController::accessDenied'
social_core.routing.yml in modules/social_features/social_core/social_core.routing.yml
modules/social_features/social_core/social_core.routing.yml

File

modules/social_features/social_core/src/Controller/SocialCoreController.php, line 62

Class

SocialCoreController
Returns responses for social_core module routes.

Namespace

Drupal\social_core\Controller

Code

public function accessDenied() {

  // Get the front page URL.
  $frontpage = $this
    ->config('system.site')
    ->get('page.front');

  // Determine the message we want to set.
  $text = $this
    ->t("<p>You have insufficient permissions to view the page you're trying to access. There could be several reasons for this:</p><ul><li>You are trying to edit content you're not allowed to edit.</li><li>You are trying to view content (from a group) you don't have access to.</li><li>You are trying to access administration pages.</li></ul><p>Click the back button of your browser to go back where you came from or click <a href=\":url\">here</a> to go to the homepage</p>", [
    ':url' => $frontpage,
  ]);

  // Return the message in the render array.
  return [
    '#markup' => $text,
  ];
}