From f7d1949cc90d525062f281db95501cc870d23768 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 3 Apr 2021 13:22:23 +0200 Subject: [PATCH] add classes to lists --- core/Elements/View.class.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/core/Elements/View.class.php b/core/Elements/View.class.php index 8517ea8..9166866 100644 --- a/core/Elements/View.class.php +++ b/core/Elements/View.class.php @@ -66,19 +66,23 @@ abstract class View extends StaticView { } // UI Functions - private function createList($items, $tag): string { - if(count($items) === 0) - return "<$tag>"; - else - return "<$tag>
  • " . implode("
  • ", $items) . "
  • "; + private function createList($items, $tag, $classes = ""): string { + + $class = ($classes ? " class=\"$classes\"" : ""); + + if(count($items) === 0) { + return "<$tag$class>"; + } else { + return "<$tag$class>
  • " . implode("
  • ", $items) . "
  • "; + } } - public function createOrderedList($items=array()): string { - return $this->createList($items, "ol"); + public function createOrderedList($items=array(), $classes = ""): string { + return $this->createList($items, "ol", $classes); } - public function createUnorderedList($items=array()): string { - return $this->createList($items, "ul"); + public function createUnorderedList($items=array(), $classes = ""): string { + return $this->createList($items, "ul", $classes); } protected function createLink($link, $title=null, $classes=""): string {