Commit 6462ddfd authored by Lee Rowlands's avatar Lee Rowlands Committed by Jess
Browse files

Issue #2908674 by tedbow: When using get() method directly on PathItem the alias is not loaded

(cherry picked from commit 867ecd84)
parent c99427e5
Loading
Loading
Loading
Loading
+8 −0
Changes for core/modules/path/src/Plugin/Field/FieldType/PathItem.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -111,6 +111,14 @@ public function set($property_name, $value, $notify = TRUE) {
    return parent::set($property_name, $value, $notify);
  }

  /**
   * {@inheritdoc}
   */
  public function get($property_name) {
    $this->ensureLoaded();
    return parent::get($property_name);
  }

  /**
   * {@inheritdoc}
   */
+3 −0
Changes for core/modules/path/tests/src/Kernel/PathItemTest.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -70,6 +70,9 @@ public function testPathItem() {
    $loaded_node = $node_storage->load($node->id());
    $this->assertFalse($loaded_node->get('path')->isEmpty());
    $this->assertEquals('/foo', $loaded_node->get('path')->alias);
    $node_storage->resetCache();
    $loaded_node = $node_storage->load($node->id());
    $this->assertEquals('/foo', $loaded_node->get('path')[0]->get('alias')->getValue());

    $node_storage->resetCache();
    $loaded_node = $node_storage->load($node->id());