public function LockrMigrateForm::submitForm in Lockr 8.4
Same name and namespace in other branches
- 8.2 src/Form/LockrMigrateForm.php \Drupal\lockr\Form\LockrMigrateForm::submitForm()
- 8.3 src/Form/LockrMigrateForm.php \Drupal\lockr\Form\LockrMigrateForm::submitForm()
- 4.x src/Form/LockrMigrateForm.php \Drupal\lockr\Form\LockrMigrateForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ LockrMigrateForm.php, line 131
Class
- LockrMigrateForm
- Form handler for Lockr move to production.
Namespace
Drupal\lockr\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$client_token = $form_state
->getValue('client_token');
$dn = [
'countryName' => 'US',
'stateOrProvinceName' => 'Washington',
'localityName' => 'Tacoma',
'organizationName' => 'Lockr',
];
try {
$result = $this->lockr
->createCertClient($client_token, $dn);
CertWriter::writeCerts('prod', $result);
$config = $this->configFactory
->getEditable('lockr.settings');
$config
->set('custom', TRUE);
$config
->set('cert_path', 'private://lockr/prod/pair.pem');
$config
->save();
} catch (\Exception $e) {
// XXX: probably log and/or show message
throw $e;
return;
}
}