taskFilterPages can filter by page type too

This commit is contained in:
Flavio Copes
2015-09-09 09:28:53 +02:00
parent 87161e0a5e
commit 08c2eea5c4

View File

@@ -417,6 +417,10 @@ class AdminController
$collection = $this->grav['pages']->all(); $collection = $this->grav['pages']->all();
if (count($flags)) { if (count($flags)) {
// Filter by state
$pageStates = array('modular', 'visible', 'routable');
if (count(array_intersect($pageStates, $flags)) > 0) {
if (in_array('modular', $flags)) if (in_array('modular', $flags))
$collection = $collection->modular(); $collection = $collection->modular();
@@ -427,6 +431,17 @@ class AdminController
$collection = $collection->routable(); $collection = $collection->routable();
} }
foreach ($pageStates as $pageState) {
unset($flags[$pageState]);
}
// Filter by page type
if (count($flags)) {
$type = $flags[0];
$collection = $collection->ofType($type);
}
}
if (!empty($queries)) { if (!empty($queries)) {
foreach ($collection as $page) { foreach ($collection as $page) {
foreach ($queries as $query) { foreach ($queries as $query) {