/** * Validates the form, both on the menu link edit and content menu link form. * * $form is not currently used, but passed here to match the normal form * validation method signature. * * @param array $form * A nested array form elements comprising the form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The current state of the form. */ protected function doValidate(array $form, FormStateInterface $form_state) { $extracted = $this->pathValidator->getUrlIfValid($form_state->getValue('url')); if (!$extracted) { $form_state->setErrorByName('url', $this->t("The path '@link_path' is either invalid or you do not have access to it.", array('@link_path' => $form_state->getValue('url')))); } }