public function SettingsForm::buildForm in Sparkpost email 8.2
Same name in this branch
- 8.2 src/Form/SettingsForm.php \Drupal\sparkpost\Form\SettingsForm::buildForm()
- 8.2 modules/sparkpost_requeue/src/Form/SettingsForm.php \Drupal\sparkpost_requeue\Form\SettingsForm::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 ConfigFormBase::buildForm
File
- modules/
sparkpost_requeue/ src/ Form/ SettingsForm.php, line 34
Class
- SettingsForm
- Settings form for sparkpost requeue.
Namespace
Drupal\sparkpost_requeue\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('sparkpost_requeue.settings');
$form['enable'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable sparkpost requeue'),
'#default_value' => $config
->get('enable'),
];
$form['max_retries'] = [
'#type' => 'number',
'#title' => $this
->t('Max number of retries of a message'),
'#default_value' => $config
->get('max_retries'),
'#states' => [
'invisible' => [
':input[name="enable"]' => [
'checked' => FALSE,
],
],
],
];
$form['minimum_time'] = [
'#type' => 'number',
'#title' => $this
->t('Minimum time between retries in seconds'),
'#default_value' => $config
->get('minimum_time'),
'#states' => [
'invisible' => [
':input[name="enable"]' => [
'checked' => FALSE,
],
],
],
];
return parent::buildForm($form, $form_state);
}