Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Pico 2.0 #15

Merged
merged 4 commits into from
Nov 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions PicoPagesList.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/
class PicoPagesList extends AbstractPicoPlugin
{
const API_VERSION = 2;
public $items;
private $currentPagePath;

Expand Down Expand Up @@ -59,13 +60,13 @@ public function onPagesLoaded(
*
* @see Pico::getTwig()
* @see DummyPlugin::onPageRendered()
* @param Twig_Environment &$twig twig template engine
* @param array &$twigVariables template variables
* @param string &$templateName file name of the template
* @param array &$twigVariables template variables
* @return void
*/
public function onPageRendering(Twig_Environment &$twig, array &$twigVariables, &$templateName)
public function onPageRendering(string &$templateName, array &$twigVariables)
{
$twig = $this->getPico()->getTwig();
$twigVariables['nested_pages'] = $this->items;

$twig->addFilter(new Twig_SimpleFilter('navigation', function($pages) {
Expand Down Expand Up @@ -124,7 +125,7 @@ private function nested_path($page)
$parent = $value;
break;
}

$parent['_childs'][$part] = $value;
$parent = &$parent['_childs'][$part];
}
Expand All @@ -143,7 +144,7 @@ private static function rtrim($str, $substr)
$length = strlen($substr);
return (substr($str, -$length) === $substr) ? substr($str, 0, -$length) : $str;
}

/**
* Filter the pages array according to given paths, as exclusive or inclusive.
*
Expand Down Expand Up @@ -235,4 +236,3 @@ private function output($pages)
return $html;
}
}
?>