getPico()->getBaseUrl(); $pieces = explode('/', '/' . $string); $returnStringParts = []; $aggregate = ''; $arr2s = ''; for ($i = 1; $i < count($pieces); $i++) { $arr2s = $arr2s . ',' . $pieces[$i]; $aggregate = $aggregate . $pieces[$i] . '/'; $anchor = sprintf('%s', $baseUrl, $aggregate, $pieces[$i]); //$returnString = $returnString . $anchor . '/'; $returnStringParts[] = $anchor; } return implode('/', $returnStringParts); } //public function onPageRendering(&$templateName, array &$twigVariables) { public function onPagesDiscovered(&$pages) { $twig = $this->getPico()->getTwig(); $twig->addFilter(new Twig_SimpleFilter('directoryChain', array($this, 'directoryChain'))); $twig->addFilter(new Twig_SimpleFilter('root', array($this, 'root'))); $twig->addFilter(new Twig_SimpleFilter('level', array($this, 'level'))); $twig->addFilter(new Twig_SimpleFilter('isIndex', array($this, 'isIndex'))); } }