class TMGMTController

Returns responses for tmgmt routes.

Hierarchy

  • class \Drupal\tmgmt\Controller\TMGMTController extends \Drupal\Core\Controller\ControllerBase

Expanded class hierarchy of TMGMTController

File

src/Controller/TMGMTController.php, line 12

Namespace

Drupal\tmgmt\Controller
View source
class TMGMTController extends ControllerBase {

  /**
   * System Manager Service.
   *
   * @var \Drupal\system\SystemManager
   */
  protected $systemManager;

  /**
   * Constructs a new TMGMTLocalController.
   *
   * @param \Drupal\system\SystemManager $system_manager
   *   System manager service.
   */
  public function __construct(SystemManager $system_manager) {
    $this->systemManager = $system_manager;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('system.manager'));
  }

  /**
   * Provides a single block from the administration menu as a page.
   */
  public function translatorAdminMenuBlockPage() {
    $contents = $this->systemManager
      ->getBlockContents();
    if (count($contents['#content']) === 1) {

      /** @var \Drupal\Core\Url $url */
      $url = reset($contents['#content'])['url'];
      return $this
        ->redirect($url
        ->getRouteName(), $url
        ->getRouteParameters(), $url
        ->getOptions());
    }
    return $contents;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
TMGMTController::$systemManager protected property System Manager Service.
TMGMTController::create public static function
TMGMTController::translatorAdminMenuBlockPage public function Provides a single block from the administration menu as a page.
TMGMTController::__construct public function Constructs a new TMGMTLocalController.