You are here

public function LoginDestinationRuleForm::validateForm in Login Destination 8.2

Same name and namespace in other branches
  1. 8 src/Form/LoginDestinationRuleForm.php \Drupal\login_destination\Form\LoginDestinationRuleForm::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/LoginDestinationRuleForm.php, line 181

Class

LoginDestinationRuleForm
Base for controller for login destination add/edit forms.

Namespace

Drupal\login_destination\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);

  // Get selected roles.
  $roles = array_filter($form_state
    ->getValue('roles'));

  // Set filtered values.
  $form_state
    ->setValue('roles', $roles);
  $form_state
    ->setValue('triggers', array_filter($form_state
    ->getValue('triggers')));

  // Get entered by user destination path.
  // $destination = $form_state->getValue('destination_path');.
  // @todo verify that selected role has access to entered path.
  // @todo verify entered paths to specific pages.
}