From fecfc467fae64e5b0c33b2ca32d0d7711f7c5fe3 Mon Sep 17 00:00:00 2001 From: John Koster Date: Sun, 3 Mar 2024 11:20:50 -0600 Subject: [PATCH 1/2] Cache blueprint calls on Page instances --- src/Structures/Page.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Structures/Page.php b/src/Structures/Page.php index 7455bd64d38..d61c33ec40b 100644 --- a/src/Structures/Page.php +++ b/src/Structures/Page.php @@ -39,6 +39,7 @@ class Page implements Arrayable, ArrayAccess, Augmentable, Entry, JsonSerializab protected $title; protected $depth; protected $data = []; + protected $blueprint; public function __construct() { @@ -418,8 +419,12 @@ public function status() public function blueprint() { + if ($this->blueprint !== null) { + return $this->blueprint; + } + if ($this->structure() instanceof Nav) { - return $this->structure()->blueprint(); + return $this->blueprint = $this->structure()->blueprint(); } } From a6c0c27427ed3d1ac057f71b0c135a79178d6c4c Mon Sep 17 00:00:00 2001 From: Jason Varga Date: Tue, 12 Mar 2024 10:54:14 -0400 Subject: [PATCH 2/2] visibility --- src/Structures/Page.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Structures/Page.php b/src/Structures/Page.php index d61c33ec40b..4d0b6b7aaf4 100644 --- a/src/Structures/Page.php +++ b/src/Structures/Page.php @@ -39,7 +39,7 @@ class Page implements Arrayable, ArrayAccess, Augmentable, Entry, JsonSerializab protected $title; protected $depth; protected $data = []; - protected $blueprint; + private $blueprint; public function __construct() {