Range.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxCloudVps\Core\UI\Widget\Forms\Fields;
  3. /**
  4. * Number Field controler
  5. *
  6. * @author Sławomir Miśkowicz <slawomir@modulesgarden.com>
  7. */
  8. class Range extends BaseField
  9. {
  10. protected $id = 'range';
  11. protected $name = 'range';
  12. protected $maxValue = null;
  13. protected $minValue = null;
  14. protected $outputVisible = true;
  15. public function __construct($id = null, $minValue = null, $maxValue = null)
  16. {
  17. parent::__construct($id);
  18. $this->minValue = $minValue;
  19. $this->maxValue = $maxValue;
  20. }
  21. public function getMinValue()
  22. {
  23. return $this->minValue;
  24. }
  25. public function setMinValue($minValue)
  26. {
  27. $this->minValue = $minValue;
  28. }
  29. public function getMaxValue()
  30. {
  31. return $this->maxValue;
  32. }
  33. public function setMaxValue($maxValue)
  34. {
  35. $this->maxValue = $maxValue;
  36. }
  37. /**
  38. * @param bool $visible
  39. */
  40. public function setOutputVisible($visible = true)
  41. {
  42. $this->outputVisible = $visible;
  43. }
  44. /**
  45. * @return bool
  46. */
  47. public function isOutputVisible()
  48. {
  49. return $this->outputVisible;
  50. }
  51. public function getOutputLabel(){
  52. if($this->getHtmlAttribute('data-label'.$this->getValue())){
  53. return $this->getHtmlAttribute('data-label'.$this->getValue());
  54. }
  55. return $this->getValue();
  56. }
  57. }