Commit 029350ec authored by Administrator's avatar Administrator 💬

chore: bug hunt

parent f41bd69a
...@@ -226,17 +226,17 @@ class M3P2Plugin extends Plugin ...@@ -226,17 +226,17 @@ class M3P2Plugin extends Plugin
return; // perhaps not return; // perhaps not
} }
/** @var Pages $pages */
$pages = $this->grav['pages'];
if (count($uri->paths()) < 2) { if (count($uri->paths()) < 2) {
// user is toying with URI, probably // user is toying with URI, probably, visiting `/lessons`.
// idea: display an index of the lessons here todo // idea: display an index of the lessons here todo
return; return;
} }
$lesson_slug = $uri->paths(1); $lesson_slug = $uri->paths(1);
/** @var Pages $pages */
$pages = $this->grav['pages'];
// VERY inefficient : TODO: cache this // VERY inefficient : TODO: cache this
// $target_pages = $pages->all()->filter(function ($p) use ($lesson_slug) { // $target_pages = $pages->all()->filter(function ($p) use ($lesson_slug) {
$target_pages = array_filter($pages->instances(), function (Page $p) use ($lesson_slug) { $target_pages = array_filter($pages->instances(), function (Page $p) use ($lesson_slug) {
...@@ -247,7 +247,7 @@ class M3P2Plugin extends Plugin ...@@ -247,7 +247,7 @@ class M3P2Plugin extends Plugin
} }
foreach ($page_config->lessons as $lesson) { foreach ($page_config->lessons as $lesson) {
// print("Checking lesson $lesson"."<br>\n"); // print("Checking lesson".print_r($lesson, true)."<br>\n");
// if ($lesson_slug == $lesson) { // if ($lesson_slug == $lesson) {
if ($lesson_slug == $lesson['slug']) { if ($lesson_slug == $lesson['slug']) {
return true; // yay, this page is part of the lesson return true; // yay, this page is part of the lesson
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment