function PathHasAlias::doEvaluate
Check if a URL path has a URL alias.
Parameters
string $path: The path to check.
\Drupal\Core\Language\LanguageInterface|null $language: An optional language to look up the path in.
Return value
bool TRUE if the path has an alias in the given language.
File
-
src/
Plugin/ Condition/ PathHasAlias.php, line 85
Class
- PathHasAlias
- Provides a 'Path has alias' condition.
Namespace
Drupal\rules\Plugin\ConditionCode
protected function doEvaluate($path, LanguageInterface $language = NULL) {
$langcode = is_null($language) ? NULL : $language->getId();
$alias = $this->aliasManager
->getAliasByPath($path, $langcode);
// getAliasByPath() returns the path if there is no alias.
return $alias != $path;
}