Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Path/PathValidatorInterface.php \Drupal\Core\Path\PathValidatorInterface
  2. 9 core/lib/Drupal/Core/Path/PathValidatorInterface.php \Drupal\Core\Path\PathValidatorInterface

Provides an interface for URL path validators.

Hierarchy

Expanded class hierarchy of PathValidatorInterface

All classes that implement PathValidatorInterface

7 files declare their use of PathValidatorInterface
ContactFormEditForm.php in core/modules/contact/src/ContactFormEditForm.php
LinkFormatterTest.php in core/modules/link/tests/src/Unit/LinkFormatterTest.php
MenuLinkContentDeprecationsTest.php in core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentDeprecationsTest.php
MenuLinkParentTest.php in core/modules/migrate/tests/src/Unit/process/MenuLinkParentTest.php
ShortcutSetController.php in core/modules/shortcut/src/Controller/ShortcutSetController.php

... See full list

File

core/lib/Drupal/Core/Path/PathValidatorInterface.php, line 8

Namespace

Drupal\Core\Path
View source
interface PathValidatorInterface {

  /**
   * Returns a URL object, if the path is valid and accessible.
   *
   * @param string $path
   *   The path to check.
   *
   * @return \Drupal\Core\Url|false
   *   The \Drupal\Core\Url object, or FALSE if the path is not valid.
   */
  public function getUrlIfValid($path);

  /**
   * Returns a URL object, if the path is valid.
   *
   * Unlike getUrlIfValid(), access check is not performed. Do not use this
   * method if the $path is about to be presented to a user.
   *
   * @param string $path
   *   The path to check.
   *
   * @return \Drupal\Core\Url|false
   *   The \Drupal\Core\Url object, or FALSE if the path is not valid.
   */
  public function getUrlIfValidWithoutAccessCheck($path);

  /**
   * Checks if the URL path is valid and accessible by the current user.
   *
   * @param string $path
   *   The path to check.
   *
   * @return bool
   *   TRUE if the path is valid.
   */
  public function isValid($path);

}

Members

Namesort descending Modifiers Type Description Overrides
PathValidatorInterface::getUrlIfValid public function Returns a URL object, if the path is valid and accessible.
PathValidatorInterface::getUrlIfValidWithoutAccessCheck public function Returns a URL object, if the path is valid.
PathValidatorInterface::isValid public function Checks if the URL path is valid and accessible by the current user.