You are here

public function DefaultController::wardenRegistration in Warden 8.2

Same name and namespace in other branches
  1. 8 src/Controller/DefaultController.php \Drupal\warden\Controller\DefaultController::wardenRegistration()
  2. 3.x src/Controller/DefaultController.php \Drupal\warden\Controller\DefaultController::wardenRegistration()

Warden registration form.

Return value

array

1 string reference to 'DefaultController::wardenRegistration'
warden.routing.yml in ./warden.routing.yml
warden.routing.yml

File

src/Controller/DefaultController.php, line 74

Class

DefaultController
Default controller for the warden module.

Namespace

Drupal\warden\Controller

Code

public function wardenRegistration() {
  $build = [];
  $warden_path = $this
    ->getWardenConfig()
    ->get('warden_server_host_path');
  if (empty($warden_path)) {
    drupal_set_message(t('You are missing some Warden configuration. Please read the README file for more details.'), 'error');
    return [];
  }
  $build['local_token'] = [
    '#markup' => '<p>' . t('Site security token: %token', [
      '%token' => $this
        ->getWardenManager()
        ->getLocalToken(),
    ]) . '</p>',
  ];
  $build['message'] = [
    '#markup' => '<p>' . t('To add this site to your Warden dashboard click the button below. Read the README file which comes with the module for configuration information.') . '</p>',
  ];
  $build['button'] = [
    '#markup' => t('<a class="button" href="@url">Add this site to your Warden Dashboard</a>', array(
      '@url' => $this
        ->generateWardenRegistrationRedirect(),
    )),
  ];
  return $build;
}