/** * @return SafeHtml|SafeHtml[] */ protected function _produceHtml() { $list = UnorderedList::create(); $list->addClass('f-obj-lst'); if ($this->_stacked > 0) { $list->addClass('f-obj-lst-stacked'); if ($this->_stacked == 1) { $list->addClass('f-obj-lst-stacked-min-border'); } } $this->_applyId($list); $this->_applyDataAttributes($list); if ($this->_alignActions) { $this->_processAlign(); } $list->addItems($this->_items); return $list; }
/** * @return SafeHtml|SafeHtml[] */ protected function _produceHtml() { $card = ListItem::create(''); $card->addClass('f-obj-lst-itm'); $card->addClass('f-obj-lst-itm-' . $this->_colour); $frame = Div::create('')->addClass('f-obj-lst-itm-frm'); $card->appendContent($frame); $actionCount = $this->_actionCount; if ($actionCount > 0) { $actions = UnorderedList::create(); $actions->addClass('f-obj-lst-itm-act'); $frame->appendContent($actions); $card->addClass('f-obj-lst-itm-w-act-' . $actionCount); foreach ($this->_actions as $action) { $li = ListItem::create($action[0]); if ($action[1]) { $li->addClass('highlight'); } $actions->addItem($li); } } $content = Div::create(''); $content->addClass('f-obj-lst-itm-cntr'); $frame->appendContent($content); $table = Div::create(''); $table->addClass('f-obj-lst-itm-tbl'); $content->appendContent($table); $row = Div::create(''); $row->addClass('f-obj-lst-itm-cntr-row'); $table->appendContent($row); $col1 = Div::create(''); $col1->addClass('f-obj-lst-itm-cntr-col'); $row->appendContent($col1); foreach ($this->_midColumns as $column) { $midCol = Div::create($column); $midCol->addClass('f-obj-lst-itm-cntr-col'); $row->appendContent($midCol); } if (!empty($this->_rightContent)) { $col2 = Div::create($this->_rightContent); $col2->addClass('f-obj-lst-itm-cntr-col'); $col2->addClass('f-obj-lst-itm-cntr-right'); $row->appendContent($col2); } $title = Div::create($this->_title); $title->addClass('f-obj-lst-itm-title'); $col1->appendContent($title); if (!empty($this->_subTitle)) { $subTitle = Div::create($this->_subTitle); $subTitle->addClass('f-obj-lst-itm-sub-title'); $col1->appendContent($subTitle); } $this->_applyDataAttributes($card); $this->_applyId($card); return $card; }
public function testAddItems() { $list = new UnorderedList(); $list->addItems(['One', ListItem::create('Two')]); $this->assertEquals('<ul><li>One</li><li>Two</li></ul>', (string) $list); }