Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PathAlias.php

function PathAlias::preSave

Overrides ContentEntityBase::preSave

File

core/modules/path_alias/src/Entity/PathAlias.php, line 96

Class

PathAlias
Defines the path_alias entity class.

Namespace

Drupal\path_alias\Entity

Code

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);
}
RSS feed
Powered by Drupal