diff --git a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php index 53ddcc2..51508e6 100644 --- a/core/modules/path/src/Plugin/Field/FieldType/PathItem.php +++ b/core/modules/path/src/Plugin/Field/FieldType/PathItem.php @@ -132,6 +132,10 @@ public function postSave($update) { $entity = $this->getEntity(); \Drupal::service('path.alias_storage')->save('/' . $entity->urlInfo()->getInternalPath(), $this->alias, $this->getLangcode(), $this->pid); } + + // Make sure that the updated alias will be computed correctly next time + // it is requested. + $this->isLoaded = FALSE; } } diff --git a/core/modules/path/tests/src/Kernel/PathItemTest.php b/core/modules/path/tests/src/Kernel/PathItemTest.php index 769fa3a..b78ca2d 100644 --- a/core/modules/path/tests/src/Kernel/PathItemTest.php +++ b/core/modules/path/tests/src/Kernel/PathItemTest.php @@ -43,10 +43,8 @@ protected function setUp() { * Test creating, loading, updating and deleting aliases through PathItem. */ public function testPathItem() { - /** @var \Drupal\Core\Path\AliasStorageInterface $alias_storage */ $alias_storage = \Drupal::service('path.alias_storage'); - $node_storage = \Drupal::entityTypeManager()->getStorage('node'); $node = Node::create([