You are here

public function SettingsForm::buildForm in WebP 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\webp\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('webp.settings');
  $form['quality'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Image quality'),
    '#description' => $this
      ->t('Specify the image quality. This setting
       will be in effect for all new image style derivatives. In order to apply
       this setting to existing image style derivatives, flush image styles
       through the interface, or by using Drush or Drupal Console.'),
    '#default_value' => $config
      ->get('quality'),
    '#min' => 1,
    '#max' => 100,
  ];
  return parent::buildForm($form, $form_state);
}