You are here

public static function UrlValidator::urlIsRoot in Mini site 8

Check if the URL is a root-level relative URL.

4 calls to UrlValidator::urlIsRoot()
PageProcessor::processTagA in src/PageProcessor.php
Process <a> tag.
PageProcessor::processTagLink in src/PageProcessor.php
Process <link> tag.
UrlValidator::rootToRelative in src/UrlValidator.php
Convert root-level URL to relative URL with parent prefix support.
UrlValidatorTest::testUrlIsRoot in tests/src/Kernel/UrlValidatorTest.php
Test for urlIsRoot().

File

src/UrlValidator.php, line 24

Class

UrlValidator
Class UrlValidator.

Namespace

Drupal\minisite

Code

public static function urlIsRoot($url) {
  return !static::urlIsExternal($url) && (substr($url, 0, 2) == './' || substr($url, 0, 1) == '/');
}