You are here

public function FlushSingleImageForm::validateForm in Flush Single Image Styles 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

src/Form/FlushSingleImageForm.php, line 121

Class

FlushSingleImageForm
Class FlushSingleImageForm.

Namespace

Drupal\flush_single_image\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if (!$form_state
    ->getValue('path')) {
    $form_state
      ->setError($form['path'], $this
      ->t('@name field is required.', [
      '@name' => $form['path']['#title'],
    ]));
  }
}