public function LockrRegisterForm::buildForm in Lockr 4.x
Same name and namespace in other branches
- 8.4 src/Form/LockrRegisterForm.php \Drupal\lockr\Form\LockrRegisterForm::buildForm()
- 8.2 src/Form/LockrRegisterForm.php \Drupal\lockr\Form\LockrRegisterForm::buildForm()
- 8.3 src/Form/LockrRegisterForm.php \Drupal\lockr\Form\LockrRegisterForm::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides FormInterface::buildForm
File
- src/
Form/ LockrRegisterForm.php, line 106
Class
- LockrRegisterForm
- Form handler for Lockr registration.
Namespace
Drupal\lockr\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['#attached']['library'][] = 'lockr/register';
$form['#attached']['drupalSettings']['lockr'] = [
'site_name' => $this
->getSiteName(),
'accounts_host' => 'https://accounts.lockr.io',
];
$form['client_token'] = [
'#type' => 'hidden',
'#required' => TRUE,
];
$form['register'] = [
'#type' => 'button',
'#value' => $this
->t('Register Site'),
'#attributes' => [
'class' => [
'register-site',
],
],
];
$form['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Submit'),
'#attributes' => [
'class' => [
'register-submit',
],
],
];
return $form;
}