public static function button($label, $flags = 0x0, $iconLeft = NULL, $iconRight = NULL) { $button = new UIButton($label); if ($iconLeft) { $button->setLeftIcon($iconLeft); } if ($iconRight) { $button->setRightIcon($iconRight); } if (($flags & self::ALIGN_RIGHT) == self::ALIGN_RIGHT) { $button->getHTML()->setStyle('float', 'right')->addClass('\\Psc\\button-right'); } if (($flags & self::ALIGN_LEFT) == self::ALIGN_LEFT) { $button->getHTML()->setStyle('float', 'left')->addClass('\\Psc\\button-left'); } if (($flags & self::CLEAR) == self::CLEAR) { $button->getHTML()->templateAppend("\n" . '<div class="clear"></div>'); } return $button; }
/** * @param ButtonInterface|string $button */ public function addButton($button, $flags = 0x0, $iconLeft = NULL, $iconRight = NULL) { if (!$button instanceof ButtonInterface) { $button = new Button($button); } if ($iconLeft) { $button->setLeftIcon($iconLeft); } if ($iconRight) { $button->setRightIcon($iconRight); } if (($flags & self::ALIGN_RIGHT) == self::ALIGN_RIGHT) { $button->getHTML()->setStyle('float', 'right')->addClass('\\Psc\\button-right'); } if (($flags & self::ALIGN_LEFT) == self::ALIGN_LEFT) { $button->getHTML()->setStyle('float', 'left')->addClass('\\Psc\\button-left'); } if (($flags & self::CLEAR) == self::CLEAR) { $button->getHTML()->templateAppend("\n" . '<div class="clear"></div>'); } if (($flags & self::PREPEND) == self::PREPEND) { array_unshift($this->buttons, $button); } else { $this->buttons[] = $button; } return $button; }