Skip to content
Snippets Groups Projects
Commit a8b23644 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Add filter options to overview plugin

parent 01075135
No related branches found
No related tags found
1 merge request!5Feature 5 2 0
......@@ -219,6 +219,17 @@ class OverviewController extends AbstractController {
}
}
// find all tags
$tagPid = $GLOBALS['TSFE']->id;
if ($this->settings['onlyNewsWithinThisPageSection']) {
/** @noinspection PhpUndefinedMethodInspection */
$tags = $this->tagRepository->findByPid($tagPid);
} else {
$tags = $this->tagRepository->findAll();
}
$this->view->assign('tags', $tags->toArray());
$this->view->assign('categories', $categories->toArray());
$this->view->assign('numberOfPages', $numberOfPages);
$this->view->assign('newsItems', $newsByCategory);
$this->view->assign('groupBy', 'category');
......@@ -245,7 +256,7 @@ class OverviewController extends AbstractController {
}
$tagPid = (int) $this->settings['tagPid'];
if(!$tagPid){
if (!$tagPid) {
$tagPid = $GLOBALS['TSFE']->id;
}
if ($this->settings['onlyNewsWithinThisPageSection']) {
......@@ -344,6 +355,15 @@ class OverviewController extends AbstractController {
}
}
if ($this->settings['onlyNewsWithinThisPageSection']) {
/** @noinspection PhpUndefinedMethodInspection */
$categories = $this->categoryRepository->findByPid($GLOBALS['TSFE']->id);
} else {
$categories = $this->categoryRepository->findAll();
}
$this->view->assign('tags', $tags->toArray());
$this->view->assign('categories', $categories->toArray());
$this->view->assign('numberOfPages', $numberOfPages);
$this->view->assign('newsItems', $newsByTag);
$this->view->assign('groupBy', 'tag');
......@@ -418,7 +438,19 @@ class OverviewController extends AbstractController {
}
}
// find all tags
$tagPid = $GLOBALS['TSFE']->id;
if ($this->settings['onlyNewsWithinThisPageSection']) {
/** @noinspection PhpUndefinedMethodInspection */
$tags = $this->tagRepository->findByPid($tagPid);
} else {
$tags = $this->tagRepository->findAll();
}
$this->view->assign('tags', $tags->toArray());
$this->view->assign('categories', $categories->toArray());
$this->view->assign('numberOfPages', $numberOfPages);
$this->view->assign('newsMetaData', $newsMetaData);
}
}
......@@ -3,6 +3,12 @@
{namespace sg=SGalinski\SgNews\ViewHelpers}
<f:section name="main">
<div id="sgnews-newslist">
<f:render partial="Filter" arguments="{controller: 'OverviewController', action: 'index', categories: categories,
tags: tags, selectedTag: selectedTag, selectedCategory: selectedCategory}" />
</div>
<br />
<div class="tx-sgnews-categories">
<ul class="nav nav-tabs">
<li class="tx-sgnews-category active">
......
......@@ -3,6 +3,12 @@
{namespace sg=SGalinski\SgNews\ViewHelpers}
<f:section name="main">
<div id="sgnews-newslist">
<f:render partial="Filter" arguments="{controller: 'OverviewController', action: 'overviewWithoutCategories', categories: categories,
tags: tags, selectedTag: selectedTag, selectedCategory: selectedCategory}" />
</div>
<br />
<div class="tx-sgnews-overview">
<ul class="tx-sgnews-list row">
<f:for each="{newsMetaData}" as="newsMetaDataEntry">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment