/** * Returns the viewstate of this control and its children. * This method is overriden to save the items data in view state, * as well as the mapping between indexes and text/value pairs for * the list items. * @return array|null viewstate to be saved */ public function saveViewState() { if ($this->items->length() > 0) { $this->setViewState('Items', $this->items); } return parent::saveViewState(); }