addClass(self::ZBX_STYLE_SORTABLE); foreach ($list as $item) { $this->add($item); } } /** * Add item to the list. * * @param mixed $item * * @return CSortable */ public function add($item): self { $this->list[] = $item; return $this; } public function toString($destroy = true) { $list = (new CTag('ul', true))->addClass(self::ZBX_STYLE_SORTABLE_LIST); foreach ($this->list as $item) { $list->addItem( (new CTag('li', true, $item)) ->addClass(self::ZBX_STYLE_SORTABLE_ITEM) ->setAttribute('tabindex', '0') ); } $this->addItem($list); return parent::toString($destroy); } }