Buttons.php 781 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxVps\Core\UI\Traits;
  3. trait Buttons
  4. {
  5. protected $buttons = [];
  6. public function addButton($button)
  7. {
  8. $this->addElement($button, 'buttons');
  9. return $this;
  10. }
  11. public function insertButton($buttonId)
  12. {
  13. if (!$this->buttons[$buttonId])
  14. {
  15. //add exception
  16. }
  17. else
  18. {
  19. $button = $this->buttons[$buttonId];
  20. return $button->getHtml();
  21. }
  22. return '';
  23. }
  24. public function getButtons()
  25. {
  26. return $this->buttons;
  27. }
  28. public function getButtonsCount()
  29. {
  30. return count($this->buttons);
  31. }
  32. public function hasButtons()
  33. {
  34. return count($this->buttons) > 0;
  35. }
  36. }