public function LockrAdminController::overview in Lockr 4.x
Same name and namespace in other branches
- 8.4 src/Controller/LockrAdminController.php \Drupal\lockr\Controller\LockrAdminController::overview()
- 8.2 src/Controller/LockrAdminController.php \Drupal\lockr\Controller\LockrAdminController::overview()
- 8.3 src/Controller/LockrAdminController.php \Drupal\lockr\Controller\LockrAdminController::overview()
Renders the Lockr status page.
1 string reference to 'LockrAdminController::overview'
File
- src/
Controller/ LockrAdminController.php, line 142
Class
- LockrAdminController
- Controller for the Lockr admin status and configuration page.
Namespace
Drupal\lockr\ControllerCode
public function overview() {
try {
$info = $this->lockr
->getInfo();
} catch (LockrApiException $e) {
if ($e
->getCode() >= 500) {
watchdog_exception('lockr', $e);
$this->messenger
->addMessage($this
->t('The Lockr service has returned an error. Please try again.'), 'error');
return [];
}
$info = [];
}
$text_config = $this->configFactory
->get('lockr.ui_text');
$ra['header'] = [
'#prefix' => '<p>',
'#markup' => $info ? $text_config
->get('admin_page.header.registered') : $text_config
->get('admin_page.header.not_registered'),
'#suffix' => '</p>',
];
$ra['status'] = $this
->getStatus($info);
$partner = $this->settingsFactory
->getPartner();
if ($partner) {
$ra['description'] = [
'#prefix' => '<p>',
'#markup' => $partner['description'],
'#suffix' => '</p>',
];
}
elseif ($info && $info['env'] === 'dev') {
$ra['migrate'] = $this->formBuilder
->getForm(LockrMigrateForm::class, $info);
}
// If register is going to attempt writing certs to the private
// directory (when there is no partner), then only allow registration
// if the private directory is set.
if (!$info && ($partner || $this
->privateValid())) {
$ra['register'] = $this->formBuilder
->getForm(LockrRegisterForm::class);
}
$auth_info = $this
->extractExpires($info);
$sev = $this
->shouldRenew($auth_info);
if ($sev !== REQUIREMENT_OK || ($_GET['lockr_force_renew'] ?? '') !== '') {
$ra['renew_cert'] = $this->formBuilder
->getForm(LockrRenewForm::class);
}
$ra['advanced'] = $this->formBuilder
->getForm(LockrAdvancedForm::class);
return $ra;
}