diff --git a/src/Pages/PublicationArchive.php b/src/Pages/PublicationArchive.php index 3809cd3..66bfeb6 100644 --- a/src/Pages/PublicationArchive.php +++ b/src/Pages/PublicationArchive.php @@ -127,7 +127,8 @@ class PublicationArchive extends Page implements ListSource * @config */ private static $allowed_children = [ - PublicationCategory::class + PublicationCategory::class, + Publication::class ]; /** @@ -229,7 +230,23 @@ public function fieldLabels($includerelations = true) */ public function getPublications() { - return $this->getSortedPublications(Publication::get()->filter('ParentID', $this->AllChildren()->column('ID') ?: null)); + $publications = ArrayList::create(); + + $publications->merge(Publication::get()->filter('ParentID', $this->AllChildren()->column('ID') ?: null)); + + $publications->merge($this->getChildMembers()); + + return $this->getSortedPublications($publications); + } + + /** + * Answers a list of the immediate child publications of the archive. + * + * @return DataList + */ + public function getChildPublications() + { + return $this->getSortedPublications($this->AllChildren()->filter('ClassName', Publication::class)); } /** @@ -288,6 +305,21 @@ public function getVisibleCategories() return $data; } + /** + * Answers the child publication list component for the template. + * + * @return BaseListComponent + */ + public function getChildPublicationList() + { + $list = clone $this->getListComponent(); + + $list->setSource($this->getChildPublications()); + $list->setStyleIDFrom($this); + + return $list; + } + /** * Answers the publication list component for the template. * diff --git a/templates/SilverWare/Publications/Pages/Layout/PublicationArchive.ss b/templates/SilverWare/Publications/Pages/Layout/PublicationArchive.ss index e2bc5ca..48e0625 100644 --- a/templates/SilverWare/Publications/Pages/Layout/PublicationArchive.ss +++ b/templates/SilverWare/Publications/Pages/Layout/PublicationArchive.ss @@ -3,4 +3,5 @@ <% include Page\Image %> <% include Page\Content %> <% include SilverWare\Publications\Pages\PublicationArchive\Categories %> + <% include SilverWare\Publications\Pages\PublicationArchive\Publications %> diff --git a/templates/SilverWare/Publications/Pages/PublicationArchive/Categories.ss b/templates/SilverWare/Publications/Pages/PublicationArchive/Categories.ss index ba460d3..ca0fb3d 100644 --- a/templates/SilverWare/Publications/Pages/PublicationArchive/Categories.ss +++ b/templates/SilverWare/Publications/Pages/PublicationArchive/Categories.ss @@ -16,6 +16,4 @@ <% end_loop %> -<% else %> - <% include Alert Type='warning', Text=$NoDataMessage %> <% end_if %> diff --git a/templates/SilverWare/Publications/Pages/PublicationArchive/Publications.ss b/templates/SilverWare/Publications/Pages/PublicationArchive/Publications.ss new file mode 100644 index 0000000..7d30532 --- /dev/null +++ b/templates/SilverWare/Publications/Pages/PublicationArchive/Publications.ss @@ -0,0 +1,5 @@ +<% if $ChildPublications %> +
+ $ChildPublicationList +
+<% end_if %>