You are here

protected function LinkToFileConstraint::getPath in File Link 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Validation/Constraint/LinkToFileConstraint.php \Drupal\file_link\Plugin\Validation\Constraint\LinkToFileConstraint::getPath()

Get URL path.

Parameters

string $url: URL.

Return value

string URL path.

2 calls to LinkToFileConstraint::getPath()
LinkToFileConstraint::hasExtension in src/Plugin/Validation/Constraint/LinkToFileConstraint.php
Check whereas given URL has an extension.
LinkToFileConstraint::hasPath in src/Plugin/Validation/Constraint/LinkToFileConstraint.php
Check whereas given URL has a path.

File

src/Plugin/Validation/Constraint/LinkToFileConstraint.php, line 118

Class

LinkToFileConstraint
Validation constraint for file_link, checking that URI points to a file.

Namespace

Drupal\file_link\Plugin\Validation\Constraint

Code

protected function getPath($url) {
  return trim((string) parse_url($url, PHP_URL_PATH), '/');
}