mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 19:36:08 +01:00
taskFilterPages can filter by page type too
This commit is contained in:
@@ -417,14 +417,29 @@ class AdminController
|
|||||||
$collection = $this->grav['pages']->all();
|
$collection = $this->grav['pages']->all();
|
||||||
|
|
||||||
if (count($flags)) {
|
if (count($flags)) {
|
||||||
if (in_array('modular', $flags))
|
// Filter by state
|
||||||
$collection = $collection->modular();
|
$pageStates = array('modular', 'visible', 'routable');
|
||||||
|
|
||||||
if (in_array('visible', $flags))
|
if (count(array_intersect($pageStates, $flags)) > 0) {
|
||||||
$collection = $collection->visible();
|
if (in_array('modular', $flags))
|
||||||
|
$collection = $collection->modular();
|
||||||
|
|
||||||
if (in_array('routable', $flags))
|
if (in_array('visible', $flags))
|
||||||
$collection = $collection->routable();
|
$collection = $collection->visible();
|
||||||
|
|
||||||
|
if (in_array('routable', $flags))
|
||||||
|
$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)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user