You are here

public function PresetsForm::buildForm in Easychart 8.3

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/PresetsForm.php, line 35
Contains \Drupal\easychart\Form\PresetsForm

Class

PresetsForm

Namespace

Drupal\easychart\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL) {
  $config = $this
    ->config('easychart.settings');
  $form['presets'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Presets'),
    '#title_display' => 'invisible',
    '#default_value' => $config
      ->get('presets'),
    '#description' => $this
      ->t('Presets for every Easychart chart. If these preset are also mentioned in the available options, they will be shown, but not editable.'),
    '#attributes' => array(
      'class' => array(
        'easychart-presets',
      ),
    ),
    '#rows' => 30,
  ];
  $form['actions']['reset'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Reset to defaults'),
    '#submit' => array(
      '::resetForm',
    ),
    '#limit_validation_errors' => array(),
    '#weight' => 100,
  ];
  return parent::buildForm($form, $form_state);
}