You are here

public function LingotekDashboardController::dashboardPage in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  2. 4.0.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  3. 3.0.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  4. 3.1.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  5. 3.2.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  6. 3.3.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  7. 3.4.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  8. 3.5.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  9. 3.6.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  10. 3.7.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()
  11. 3.8.x src/Controller/LingotekDashboardController.php \Drupal\lingotek\Controller\LingotekDashboardController::dashboardPage()

Presents a dashboard overview page of translation status through Lingotek.

Parameters

\Symfony\Component\HttpFoundation\Request $request: The page request.

Return value

array The dashboard form, or a redirect to the connect page.

1 string reference to 'LingotekDashboardController::dashboardPage'
lingotek.routing.yml in ./lingotek.routing.yml
lingotek.routing.yml

File

src/Controller/LingotekDashboardController.php, line 106

Class

LingotekDashboardController
Returns responses for lingotek module setup routes.

Namespace

Drupal\lingotek\Controller

Code

public function dashboardPage(Request $request) {
  if ($redirect = $this
    ->checkSetup()) {
    return $redirect;
  }
  $cms_data = $this
    ->getDashboardInfo();
  $build = [];
  $this
    ->moduleHandler()
    ->loadInclude('locale', 'install');
  $requirements = locale_requirements('runtime');
  $build['#attached']['library'][] = 'lingotek/lingotek.dashboard';
  $build['#attached']['drupalSettings']['lingotek']['cms_data'] = $cms_data;
  $build['#title'] = $this
    ->t('Dashboard');
  $build['ltk-dashboard'] = [
    '#type' => 'container',
    '#attributes' => [
      'ltk-dashboard' => '',
      'ng-app' => 'LingotekApp',
      'style' => 'margin-top: -15px;',
    ],
  ];
  if (isset($requirements['locale_translation']) && isset($requirements['locale_translation']['description'])) {
    drupal_set_message($requirements['locale_translation']['description'], 'warning');
  }
  return $build;
}