| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Traits;
- trait Buttons
- {
- protected $buttons = [];
- public function addButton($button)
- {
- $this->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;
- }
- }
|