/** * Helper function to create a SplitButton * If $iconUrl is set it asigns the corresponding CssClass 'x-btn-text-icon' to show icon and text. * * @param string $text * @param string $iconUrl * @param PhpExt_Handler $handler * @return PhpExt_Toolbar_Button */ public static function createSplitButton($text, $iconUrl = null, $arrowHandler = null) { $btn = new PhpExt_Toolbar_Button(); $btn->setText($text); if ($iconUrl !== null) { $btn->setIcon($iconUrl); if ($btn->getCssClass() == null) { $btn->setCssClass("x-btn-text-icon"); } } if ($arrowHandler !== null) { $btn->setArrowHandler($arrowHandler); } return $btn; }
/** * Helper function to quick add a button * * @param string $key * @param string $text The text to show in the button * @param string $iconUrl The URL of and image to show as button's icon * @return PhpExt_Toolbar_Button */ public function addButton($key, $text, $iconUrl = null, $handler = null) { include_once 'PhpExt/Toolbar/Button.php'; $this->_items->add(PhpExt_Toolbar_Button::createButton($text, $iconUrl, $handler), $key); return $this->_items->getByName($key); }