*/
namespace Magento\Framework\Data\Form\Element;
use Magento\Framework\Escaper;
class Time extends AbstractElement
{
/**
* @param Factory $factoryElement
* @param CollectionFactory $factoryCollection
* @param Escaper $escaper
* @param array $data
*/
public function __construct(
Factory $factoryElement,
CollectionFactory $factoryCollection,
Escaper $escaper,
$data = []
) {
parent::__construct($factoryElement, $factoryCollection, $escaper, $data);
$this->setType('time');
}
/**
* @return mixed
*/
public function getName()
{
$name = parent::getName();
if (strpos($name, '[]') === false) {
$name .= '[]';
}
return $name;
}
/**
* @return string
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function getElementHtml()
{
$this->addClass('select admin__control-select');
$valueHrs = 0;
$valueMin = 0;
$valueSec = 0;
if ($value = $this->getValue()) {
$values = explode(',', $value);
if (is_array($values) && count($values) == 3) {
$valueHrs = $values[0];
$valueMin = $values[1];
$valueSec = $values[2];
}
}
$html = '_getUiId() . '/>';
$html .= '' . "\n";
$html .= ': ' . "\n";
$html .= ': ' . "\n";
$html .= $this->getAfterElementHtml();
return $html;
}
}