Added support for showModular option in Pages::getList()

This commit is contained in:
Andy Miller 2017-04-21 22:18:36 -06:00
parent 13b3b9875e
commit f6d910f226
No known key found for this signature in database
GPG Key ID: E82B8D0EAB94EFB9
2 changed files with 11 additions and 7 deletions

View File

@ -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:

View File

@ -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));
}
}
}