addItem($value); } if (!$values) { $this->addItem(_('List is empty'), 'empty'); $this->emptyList = true; } } private function prepareItem($value = null, $class = null, $id = null) { if ($value !== null) { $value = new CListItem($value); if ($class !== null) { $value->addClass($class); } if ($id !== null) { $value->setId($id); } } return $value; } public function addItem($value, $class = null, $id = null) { if (!is_null($value) && $this->emptyList) { $this->emptyList = false; $this->items = []; } if ($value instanceof CListItem) { parent::addItem($value); } else { parent::addItem($this->prepareItem($value, $class, $id)); } return $this; } }