MappingController.php in GatherContent 8.5
File
gathercontent_ui/src/Controller/MappingController.php
View source
<?php
namespace Drupal\gathercontent_ui\Controller;
use Cheppers\GatherContent\GatherContentClientInterface;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
class MappingController extends ControllerBase {
protected $client;
public function __construct(GatherContentClientInterface $client) {
$this->client = $client;
}
public static function create(ContainerInterface $container) {
return new static($container
->get('gathercontent.client'));
}
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,
];
}
}