You are here

public function LayoutForm::validateForm in Bootstrap Layout Builder 1.x

Same name and namespace in other branches
  1. 2.x src/Form/LayoutForm.php \Drupal\bootstrap_layout_builder\Form\LayoutForm::validateForm()

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/LayoutForm.php, line 84

Class

LayoutForm
Class LayoutForm.

Namespace

Drupal\bootstrap_layout_builder\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!is_numeric($form_state
    ->getValue('number_of_columns'))) {
    $form_state
      ->setErrorByName('number_of_columns', $this
      ->t('Number of columns must be a number!'));
  }
}