You are here

public function MappingController::testConnectionPage in GatherContent 8.4

Same name in this branch
  1. 8.4 src/Controller/MappingController.php \Drupal\gathercontent\Controller\MappingController::testConnectionPage()
  2. 8.4 gathercontent_ui/src/Controller/MappingController.php \Drupal\gathercontent_ui\Controller\MappingController::testConnectionPage()
Same name and namespace in other branches
  1. 8.3 src/Controller/MappingController.php \Drupal\gathercontent\Controller\MappingController::testConnectionPage()

Page callback for connection testing page.

Return value

array Content of the page.

File

src/Controller/MappingController.php, line 45

Class

MappingController
Class MappingController.

Namespace

Drupal\gathercontent\Controller

Code

public function testConnectionPage() {
  $message = $this
    ->t('Connection successful.');
  try {
    $this->client
      ->meGet();
  } catch (\Exception $e) {
    $message = $this
      ->t("Connection wasn't successful.");
  }
  return [
    '#type' => 'markup',
    '#markup' => $message,
  ];
}