Range.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 getMaxValue()
  26. {
  27. return $this->maxValue;
  28. }
  29. /**
  30. * @param bool $visible
  31. */
  32. public function setOutputVisible($visible = true)
  33. {
  34. $this->outputVisible = $visible;
  35. }
  36. /**
  37. * @return bool
  38. */
  39. public function isOutputVisible()
  40. {
  41. return $this->outputVisible;
  42. }
  43. public function getOutputLabel(){
  44. if($this->getHtmlAttribute('data-label'.$this->getValue())){
  45. return $this->getHtmlAttribute('data-label'.$this->getValue());
  46. }
  47. return $this->getValue();
  48. }
  49. }