You are here

public function IconBundleOverviewForm::validateForm in Icon API 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/IconBundleOverviewForm.php, line 103

Class

IconBundleOverviewForm
Configure file system settings for this site.

Namespace

Drupal\icon\Form

Code

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

  // Ensure only authorized users can submit the form.
  if (!\Drupal::currentUser()
    ->hasPermission('administer icons')) {
    form_set_error('', t('You are not authorized to submit this form.'));
  }
  $view_path_alias = $form_state
    ->getValue('icon_api_view_path_alias');

  // @FIXME
  // menu_get_item() has been removed. To retrieve route information, use the
  // RouteMatch object, which you can retrieve by calling \Drupal::routeMatch().
  //
  //
  // @see https://www.drupal.org/node/2203305
  // if ($form['global']['icon_api_view_path_alias']['#default_value'] !== $form_state['values']['icon_api_view_path_alias'] && menu_get_item($view_path_alias)) {
  //     form_set_error('icon_api_view_path_alias', t('The view path alias provided, "%url", is already in use. Please enter a different path.', array(
  //       '%url' => $view_path_alias,
  //     )));
  //   }

  //$form_state->setErrorByName('icon_api_view_path_alias', $this->t('The view path alias provided'));
}