addElement($button, 'buttons'); return $this; } public function insertButton($buttonId) { if (!$this->buttons[$buttonId]) { //add exception } else { $button = $this->buttons[$buttonId]; return $button->getHtml(); } return ''; } public function getButtons() { return $this->buttons; } /** * @param $buttonId * @return mixed|null */ public function getButton($buttonId) { return isset($this->buttons[$buttonId]) ? $this->buttons[$buttonId] : null; } public function getButtonsCount() { return count($this->buttons); } public function hasButtons() { return count($this->buttons) > 0; } }