You are here

public function SettingsForm::buildForm in CKEditorHeight 8

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/SettingsForm.php, line 32

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\ckeditorheight\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('ckeditorheight.settings');
  $form['offset'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Offset'),
    '#description' => $this
      ->t('The offset, aka height for zero lines.'),
    '#default_value' => $config
      ->get('offset'),
  ];
  $form['line_height'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Line height'),
    '#description' => $this
      ->t('The line height.'),
    '#default_value' => $config
      ->get('line_height'),
  ];
  $form['unit'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Unit'),
    '#description' => $this
      ->t('The unit for offset and line height.'),
    '#maxlength' => 4,
    '#size' => 4,
    '#default_value' => $config
      ->get('unit'),
  ];
  $form['disable_autogrow'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Disable autogrow'),
    '#description' => $this
      ->t('Without this, more content increases editor height up to screen height.'),
    '#default_value' => $config
      ->get('disable_autogrow'),
  ];
  return parent::buildForm($form, $form_state);
}