<?php
namespace PHPFUI;
class SliderHandle extends \PHPFUI\HTML5Element
{
private ?\PHPFUI\HTML5Element $input = null;
public function __construct(private int $value = 0, private ?\PHPFUI\Input $bind = null)
{
parent::__construct('span');
$this->addClass('slider-handle');
$this->setAttribute('data-slider-handle');
$this->setAttribute('role', 'slider');
$this->setAttribute('tabindex', '1');
if ($bind)
{
$this->addAttribute('aria-controls', $bind->getId());
$bind->setValue((string)$value);
}
else
{
$this->input = new \PHPFUI\HTML5Element('input');
$this->input->getId();
$this->input->setAttribute('type', 'hidden');
$this->input->setAttribute('value', (string)$value);
}
}
public function getBind() : ?Input
{
return $this->bind;
}
public function getInput() : ?HTML5Element
{
return $this->input;
}
public function getValue() : int
{
return $this->value;
}
}