You are here

public function RateWidgetForm::templateSelectorNextValidate in Rate 8.2

Provides custom validation handler for the template selector.

Parameters

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

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

File

src/RateWidgetForm.php, line 596

Class

RateWidgetForm
Form controller for vote type forms.

Namespace

Drupal\rate

Code

public function templateSelectorNextValidate(array &$form, FormStateInterface $form_state) {
  $template = $form_state
    ->getValue('template');
  if (!isset($template) || $template == '') {

    // Set an error if "template" is empty.
    $form_state
      ->setErrorByName('template', $this
      ->t('Select a template to continue!'));
  }
}