mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Added support for showModular option in Pages::getList()
This commit is contained in:
parent
13b3b9875e
commit
f6d910f226
|
|
@ -12,12 +12,13 @@ form:
|
|||
fields:
|
||||
home.alias:
|
||||
type: pages
|
||||
size: medium
|
||||
size: large
|
||||
classes: fancy
|
||||
label: PLUGIN_ADMIN.HOME_PAGE
|
||||
show_all: false
|
||||
show_modular: false
|
||||
show_root: false
|
||||
show_slug: true
|
||||
help: PLUGIN_ADMIN.HOME_PAGE_HELP
|
||||
|
||||
home.hide_in_urls:
|
||||
|
|
|
|||
|
|
@ -552,14 +552,17 @@ class Pages
|
|||
* Get list of route/title of all pages.
|
||||
*
|
||||
* @param Page $current
|
||||
* @param int $level
|
||||
* @param int $level
|
||||
* @param bool $rawRoutes
|
||||
*
|
||||
* @param bool $showAll
|
||||
* @param bool $showFullpath
|
||||
* @param bool $showSlug
|
||||
* @param bool $showModular
|
||||
* @param bool $limitLevels
|
||||
* @return array
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function getList(Page $current = null, $level = 0, $rawRoutes = false, $showAll = true, $showFullpath = false, $showSlug = false, $limitLevels = false)
|
||||
public function getList(Page $current = null, $level = 0, $rawRoutes = false, $showAll = true, $showFullpath = false, $showSlug = false, $showModular = false, $limitLevels = false)
|
||||
{
|
||||
if (!$current) {
|
||||
if ($level) {
|
||||
|
|
@ -594,8 +597,8 @@ class Pages
|
|||
|
||||
if ($limitLevels == false || ($level+1 < $limitLevels)) {
|
||||
foreach ($current->children() as $next) {
|
||||
if ($showAll || $next->routable()) {
|
||||
$list = array_merge($list, $this->getList($next, $level + 1, $rawRoutes, $showAll, $showFullpath, $showSlug, $limitLevels));
|
||||
if ($showAll || $next->routable() || ($next->modular() && $showModular)) {
|
||||
$list = array_merge($list, $this->getList($next, $level + 1, $rawRoutes, $showAll, $showFullpath, $showSlug, $showModular, $limitLevels));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user