Buttons.php 688 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\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. }