PathValidatorInterface.php

Same filename and directory in other branches
  1. 9 core/lib/Drupal/Core/Path/PathValidatorInterface.php
  2. 8.9.x core/lib/Drupal/Core/Path/PathValidatorInterface.php
  3. 10 core/lib/Drupal/Core/Path/PathValidatorInterface.php

Namespace

Drupal\Core\Path

File

core/lib/Drupal/Core/Path/PathValidatorInterface.php

View source
<?php

namespace Drupal\Core\Path;


/**
 * Provides an interface for URL path validators.
 */
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);

}

Interfaces

Title Deprecated Summary
PathValidatorInterface Provides an interface for URL path validators.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.