You are here

SocialCoreController.php in Open Social 8.3

File

modules/social_features/social_core/src/Controller/SocialCoreController.php
View source
<?php

namespace Drupal\social_core\Controller;

use Drupal\Core\Controller\ControllerBase;

/**
 * Returns responses for social_core module routes.
 */
class SocialCoreController extends ControllerBase {

  /**
   * Custom function for returning markup on the access denied page.
   */
  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,
    ];
  }

  /**
   * Empty page for the homepage.
   */
  public function stream() {
    $element = [
      '#markup' => '',
    ];
    return $element;
  }

}

Classes

Namesort descending Description
SocialCoreController Returns responses for social_core module routes.