function PathAlias::preSave
Same name in other branches
- 9 core/modules/path_alias/src/Entity/PathAlias.php \Drupal\path_alias\Entity\PathAlias::preSave()
- 10 core/modules/path_alias/src/Entity/PathAlias.php \Drupal\path_alias\Entity\PathAlias::preSave()
- 11.x core/modules/path_alias/src/Entity/PathAlias.php \Drupal\path_alias\Entity\PathAlias::preSave()
Overrides ContentEntityBase::preSave
File
-
core/
modules/ path_alias/ src/ Entity/ PathAlias.php, line 94
Class
- PathAlias
- Defines the path_alias entity class.
Namespace
Drupal\path_alias\EntityCode
public function preSave(EntityStorageInterface $storage) {
parent::preSave($storage);
// Trim the alias value of whitespace and slashes. Ensure to not trim the
// slash on the left side.
$alias = rtrim(trim($this->getAlias()), "\\/");
$this->setAlias($alias);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.