mirror of
https://github.com/typemill/typemill.git
synced 2025-07-30 19:00:32 +02:00
add pagelist extension for news
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_rewrite.c>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
@@ -64,9 +64,6 @@ RewriteRule (^|/)\.(?!well-known\/) index.php [L]
|
||||
RewriteRule ^(system\/typemill\/author\/css\/) - [L]
|
||||
RewriteRule ^(system\/typemill\/author\/img\/) - [L]
|
||||
RewriteRule ^(system\/typemill\/author\/js\/) - [L]
|
||||
RewriteRule ^(system\/author\/css\/) - [L]
|
||||
RewriteRule ^(system\/author\/img\/) - [L]
|
||||
RewriteRule ^(system\/author\/js\/) - [L]
|
||||
|
||||
# redirect all other direct requests to the following physical folders to the index.php so pages with same name work
|
||||
RewriteRule ^(system|content|data|settings|(media\/files\/)) index.php [QSA,L]
|
||||
|
35
system/typemill/Extensions/TwigPagelistExtension.php
Normal file
35
system/typemill/Extensions/TwigPagelistExtension.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Typemill\Extensions;
|
||||
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
class TwigPagelistExtension extends AbstractExtension
|
||||
{
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new TwigFunction('getPageList', array($this, 'getList' ))
|
||||
];
|
||||
}
|
||||
|
||||
public function getList($folderContentDetails, $url, $result = NULL)
|
||||
{
|
||||
foreach($folderContentDetails as $key => $item)
|
||||
{
|
||||
# set item active, needed to move item in navigation
|
||||
if($item->urlRelWoF === $url)
|
||||
{
|
||||
$item->active = true;
|
||||
$result = $item;
|
||||
}
|
||||
elseif($item->elementType === "folder")
|
||||
{
|
||||
$result = $this->getList($item->folderContent, $url, $result);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
@@ -34,6 +34,7 @@ use Typemill\Extensions\TwigUserExtension;
|
||||
use Typemill\Extensions\TwigLanguageExtension;
|
||||
use Typemill\Extensions\TwigMarkdownExtension;
|
||||
use Typemill\Extensions\TwigMetaExtension;
|
||||
use Typemill\Extensions\TwigPagelistExtension;
|
||||
use Typemill\Extensions\TwigCaptchaExtension;
|
||||
|
||||
$timer = [];
|
||||
@@ -275,6 +276,7 @@ $container->set('view', function() use ($settings, $urlinfo, $translations) {
|
||||
$twig->addExtension(new TwigLanguageExtension( $translations ));
|
||||
$twig->addExtension(new TwigMarkdownExtension());
|
||||
$twig->addExtension(new TwigMetaExtension());
|
||||
$twig->addExtension(new TwigPagelistExtension());
|
||||
$twig->addExtension(new TwigCaptchaExtension());
|
||||
|
||||
return $twig;
|
||||
|
Reference in New Issue
Block a user