Select.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields;
  3. /**
  4. * Select field controler
  5. *
  6. * @autor ThurData <info@thurdata.ch>
  7. */
  8. class Select extends BaseField
  9. {
  10. protected $id = 'select';
  11. protected $name = 'select';
  12. protected $multiple = false;
  13. protected $availableValues = [];
  14. protected $htmlAttributes = [
  15. '@change' => 'selectChangeAction($event)'
  16. ];
  17. public function setSelectedValue($value)
  18. {
  19. $this->value = $value;
  20. return $this;
  21. }
  22. public function setAvailableValues($values)
  23. {
  24. if(is_array($values))
  25. {
  26. $this->availableValues = $values;
  27. }
  28. return $this;
  29. }
  30. public function getAvailableValues()
  31. {
  32. return $this->availableValues;
  33. }
  34. public function isMultiple()
  35. {
  36. return $this->multiple;
  37. }
  38. public function enableMultiple()
  39. {
  40. $this->multiple = true;
  41. return $this;
  42. }
  43. public function disableMultiple()
  44. {
  45. $this->multiple = false;
  46. return $this;
  47. }
  48. }