You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to implement modular pages within my module I came across an error thrown by Page.php:
“Call to a member function root() on null” on line 2508
The code is 2506 $child_page = $pages->find($uri->route())->parent(); 2507 if ($child_page) { 2508 while (!$child_page->root()) { 2509 if ($this->path() === $child_page->path()) { 2510 return true; 2511 } 2512 $child_page = $child_page->parent(); 2513 } 2514 }
Looking around I found a similar/nearly identical function activeChild() in /system/src/Grav/Common/Flex/Types/Pages/Traits/PageRoutableTrait.php with code 109 $child_page = $page ? $page->parent() : null; 110 while ($child_page && !$child_page->root()) { 111 if ($this->path() === $child_page->path()) { 112 return true; 113 } 114 $child_page = $child_page->parent(); 115 }
After changing Page.php the error was gone. This may be incorporated into the code of Page.php.
Thanks, Birger
The text was updated successfully, but these errors were encountered:
While trying to implement modular pages within my module I came across an error thrown by Page.php:
“Call to a member function root() on null” on line 2508
The code is
2506 $child_page = $pages->find($uri->route())->parent();
2507 if ($child_page) {
2508 while (!$child_page->root()) {
2509 if ($this->path() === $child_page->path()) {
2510 return true;
2511 }
2512 $child_page = $child_page->parent();
2513 }
2514 }
Looking around I found a similar/nearly identical function activeChild() in /system/src/Grav/Common/Flex/Types/Pages/Traits/PageRoutableTrait.php with code
109 $child_page = $page ? $page->parent() : null;
110 while ($child_page && !$child_page->root()) {
111 if ($this->path() === $child_page->path()) {
112 return true;
113 }
114 $child_page = $child_page->parent();
115 }
After changing Page.php the error was gone. This may be incorporated into the code of Page.php.
Thanks, Birger
The text was updated successfully, but these errors were encountered: