public function buildOpenTag() { if (empty($this->attributes['field1']) && empty($this->attributes['field2'])) { throw new HtmlTagException('FormTimeRange input requires attributes: [field1] and [field2]'); } else { if (empty($this->attributes['field1'])) { $this->attributes['field1'] = $this->attributes['name']; } else { if (empty($this->attributes['field2'])) { $this->attributes['field2'] = $this->attributes['name']; } } } $this->processEnabler(); $backup = $this->attributes; // filter attributes to show only required ones $this->attributes = array_intersect_key($this->attributes, array('id' => '', 'name' => '', 'class' => '', 'data-enabler' => '')); $this->addClass('time-range-input-container')->setAttribute('data-type', 'time-range'); $this->id; //< make id if not set unset($this->attributes['name']); //< needed only for id $openTag = parent::buildOpenTag(); $this->attributes = $backup; return $this->getHiddenInput($this->attributes['field1']) . $this->getHiddenInput($this->attributes['field2']) . $openTag; }
public function buildOpenTag() { $this->loadValue(); $this->processEnabler(); if ($this->withSeconds) { $this->setAttribute('data-show-seconds', '1'); } $backup = $this->attributes; // filter attributes to show only required ones $this->attributes = array_intersect_key($this->attributes, array('id' => '', 'name' => '', 'class' => '', 'type' => '', 'data-enabler' => '', 'value' => '')); $this->setType('text')->setClass('time-input')->setAttribute('data-type', 'time'); $this->id; //< make id if not set unset($this->attributes['name']); //< needed only for id $openTag = parent::buildOpenTag(); $this->attributes = $backup; return $this->getHiddenInput($this->name) . $openTag; }