You are here

public function TMGMTController::translatorAdminMenuBlockPage in Translation Management Tool 8

Provides a single block from the administration menu as a page.

1 string reference to 'TMGMTController::translatorAdminMenuBlockPage'
tmgmt.routing.yml in ./tmgmt.routing.yml
tmgmt.routing.yml

File

src/Controller/TMGMTController.php, line 41

Class

TMGMTController
Returns responses for tmgmt routes.

Namespace

Drupal\tmgmt\Controller

Code

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;
}