public function IntervalsForm::buildForm in Subscriptions 2.0.x
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
- src/
Form/ IntervalsForm.php, line 23
Class
- IntervalsForm
- Defines the intervals settings form.
Namespace
Drupal\subscriptions\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('subscriptions.settings');
$form['intervals'] = [
'#type' => 'textarea',
'#title' => $this
->t('Intervals'),
'#description' => $this
->t('Each interval is defined by a single line in the format
<em>seconds|label</em>. Adding a new interval is simple, but removing an
interval that is already in use is not recommended.'),
'#placeholder' => "1|As soon as possible\n900|Every 15 minutes",
'#default_value' => $config
->get('intervals'),
'#element_validate' => [
[
$this,
'validateIntervals',
],
],
];
return parent::buildForm($form, $form_state);
}