public function LockrAdvancedForm::buildForm in Lockr 8.2
Same name and namespace in other branches
- 8.4 src/Form/LockrAdvancedForm.php \Drupal\lockr\Form\LockrAdvancedForm::buildForm()
- 8.3 src/Form/LockrAdvancedForm.php \Drupal\lockr\Form\LockrAdvancedForm::buildForm()
- 4.x src/Form/LockrAdvancedForm.php \Drupal\lockr\Form\LockrAdvancedForm::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/ LockrAdvancedForm.php, line 45
Class
Namespace
Drupal\lockr\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['fs'] = [
'#type' => 'details',
'#title' => 'Advanced',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['fs']['region'] = [
'#type' => 'radios',
'#title' => 'Region',
'#default_value' => $this->state
->get('lockr.region', 'us'),
'#options' => [
'us' => 'US',
'eu' => 'EU',
],
];
$form['fs']['custom'] = [
'#type' => 'checkbox',
'#title' => 'Set custom certificate location',
'#default_value' => (bool) $this->state
->get('lockr.custom', FALSE),
];
$form['fs']['custom_cert'] = [
'#type' => 'textfield',
'#title' => 'Certificate path',
'#default_value' => $this->state
->get('lockr.cert'),
'#states' => [
'visible' => [
':input[name="custom"]' => [
'checked' => TRUE,
],
],
],
];
$form['fs']['submit'] = [
'#type' => 'submit',
'#value' => 'Save',
];
return $form;
}