Create html 5 date input
@param string|null $name
@param string|null $value
@param array|string|null $attr
@return Input\Input
546108
public function date($name = null, $value = null, $attr = null)
    {
        return $this->createInput('date', $name, $value, $attr);
    }
1163461
public function attr($attribute, $value = null)
    {
        if (is_array($attribute)) return $this->attributes($attribute);
        if ($value) return $this->attributes(array($attribute => $value));
    }
1002039
public function appendAttribute($attr, $value)
    {
        $this->setAttribute($attr, trim($this->getAttribute($attr) . $value));

        return $this;
    }
564947
public function attr($name, $value = null)
    {
        if ($value === null) {
            return $this->getAttribute($name);
        }

        return $this->setAttribute($name, $value);
    }
327533
protected function createAttributeValue($name, $value) {
    // If the value is already an AttributeValueBase object,
    // return a new instance of the same class, but with the new name.
    if ($value instanceof AttributeValueBase) {
      $class = get_class($value);
      return new $class($name, $value->value());
    }
    // An array value or 'class' attribute name are forced to always be an
    // AttributeArray value for consistency.
    if ($name == 'class' && !is_array($value)) {
      // Cast the value to string in case it implements MarkupInterface.
      $value = [(string) $value];
    }
    if (is_array($value)) {
      // Cast the value to an array if the value was passed in as a string.
      // @todo Decide to fix all the broken instances of class as a string
      // in core or cast them.
      $value = new AttributeArray($name, $value);
    }
    elseif (is_bool($value)) {
      $value = new AttributeBoolean($name, $value);
    }
    // As a development aid, we allow the value to be a safe string object.
    elseif (SafeMarkup::isSafe($value)) {
      // Attributes are not supposed to display HTML markup, so we just convert
      // the value to plain text.
      $value = PlainTextOutput::renderFromHtml($value);
      $value = new AttributeString($name, $value);
    }
    elseif (!is_object($value)) {
      $value = new AttributeString($name, $value);
    }
    return $value;
  }
941214
public function addAttribute($name = null, $value)
    {
        if ($value) {
            $this->attributes[$name] = $value;
        }
        return $this;
    }
367671
public function select($name = null, array $options = array(), $value = null, $attr = null, $first = null)
    {
        $select = new Input\Select($name);

        if($name)
            $select->attr('id', $name);

        if(count($options) > 0)
            $select->options($options);
        elseif (isset($this->dataOptions[$name]))
            $select->options($this->dataOptions[$name]);

        if($value)
            $select->value($value);
        else if(isset($this->data[$name]))
            $select->value($this->data[$name]);

        if($attr)
            $select->attr($attr);

        if(isset($this->override[$name]))
            $select->override($this->override[$name]);

        if($first)
            $select->first($first);

        return $select;
    }
68575
public function setAttr($attr, $value = null)
    {
        if (is_array($attr)) {
            $this->attr = array_merge($this->attr, $attr);

            return $this;
        }

        $this->attr[$attr] = $value;

        return $this;
    }
1247433
public function attribute(string $name, string $value = null) : object
    {
        $this->attributes[$name] = $value;
        return $this;
    }
495845
public static function selectTimestamp(string $name = '', $value = 0, array $attributes = []): string
    {
        $defaultAttributes = ['method-get' => false, 'time-controll' => true];
        $userAttributes = \array_merge($defaultAttributes, $attributes);
        $timeControll = $userAttributes['time-controll'];
        $isEnabled = !isset($userAttributes['disabled']);
        $userAttributes = static::clearAttributes($userAttributes, ['time-controll']);
        $timezone = \date_default_timezone_get();

        $nameY = \sprintf('%s_y', $name);
        $nameM = \sprintf('%s_m', $name);
        $nameD = \sprintf('%s_d', $name);
        $nameH = \sprintf('%s_h', $name);
        $nameI = \sprintf('%s_i', $name);
        $nameS = \sprintf('%s_s', $name);
        $maxD = 31;

        $valY = $valM = $valD = $valH = $valI = $valS = -1;

        if (\is_array($value)) {
            $valY = $value['y'];
            $valM = $value['m'];
            $valD = $value['d'];
            $valH = \intval(0 + $value['h']);
            $valI = \intval(0 + $value['i']);
            $valS = \intval(0 + $value['s']);
        } elseif ($value != 0) {
            $valY = (new \DateTime('@'.$value))->setTimezone(new \DateTimeZone($timezone))->format('Y');
            $valM = (new \DateTime('@'.$value))->setTimezone(new \DateTimeZone($timezone))->format('n');
            $valD = (new \DateTime('@'.$value))->setTimezone(new \DateTimeZone($timezone))->format('j');
            $valH = \intval((new \DateTime('@'.$value))->setTimezone(new \DateTimeZone($timezone))->format('H'));
            $valI = \intval((new \DateTime('@'.$value))->setTimezone(new \DateTimeZone($timezone))->format('i'));
            $valS = \intval((new \DateTime('@'.$value))->setTimezone(new \DateTimeZone($timezone))->format('s'));
        }

        if ($valY > 0 && $valM > 0) {
            $format = \sprintf('%04s-%02s-01 00:00:00', $valY, $valM);
            $maxD = (int)(new \DateTime($format))->format('t');
        }

        $userAttributes['id'] = $nameY;
        $userAttributes['wrapper-class'] = 'year';
        $selectY = Choice::select($nameY, static::getYears(), [$valY], $userAttributes);

        $userAttributes['id'] = $nameM;
        $userAttributes['wrapper-class'] = 'month';
        $selectM = Choice::select($nameM, static::getMonths(), [$valM], $userAttributes);

        $userAttributes['id'] = $nameD;
        $userAttributes['wrapper-class'] = 'day';
        $selectD = Choice::select($nameD, static::getDays($maxD), [$valD], $userAttributes);

        $selectH = Text::inputHidden($nameH, '00', $userAttributes);
        $selectI = Text::inputHidden($nameI, '00', $userAttributes);
        $selectS = Text::inputHidden($nameS, '00', $userAttributes);

        if ($timeControll === true) {
            $userAttributes['id'] = $nameH;
            $userAttributes['wrapper-class'] = 'hour';
            $selectH = Choice::select($nameH, static::getHours(), [$valH], $userAttributes);

            $userAttributes['id'] = $nameI;
            $userAttributes['wrapper-class'] = 'minute';
            $selectI = Choice::select($nameI, static::getMinutes(), [$valI], $userAttributes);

            $userAttributes['id'] = $nameS;
            $userAttributes['wrapper-class'] = 'second';
            $selectS = Choice::select($nameS, static::getSeconds(), [$valS], $userAttributes);
        }

        $btnTitle = static::getConstant(
            'TXT_PANEL_DATA_FORM_TIMESTAMP_CONTROLL_RESET',
            'TXT_PANEL_DATA_FORM_TIMESTAMP_CONTROLL_RESET'
        );
        $resetBtn = $isEnabled ? Tags::span('', ['class' => 'timestamp-reset', 'title' => $btnTitle]) : '';
        $controll = $selectY.$selectM.$selectD.$selectH.$selectI.$selectS.$resetBtn;

        return Tags::div($controll, ['class' => 'timestamp-controll cf']);
    }
1151512
public function setAttr($name, $value = null)
    {
        $wrapper = $this->getWrapper();
        
        // set attribute.
        $wrapper[$name] = $value;

        return $this->setWrapper($wrapper);
    }
251886
public function datetime($name = null, $value = null) 
	{
		Argument::i()
			->test(1, 'string', 'null')
			->test(2, 'scalar', 'null');
			
		$field = Datetime::i();
		
		if(!is_null($name)) {
			$field->setName($name);
		}
		
		if(!is_null($value)) {
			$field->setValue($value);
		}
		
		return $field;
	}
849021
function text($name, $value, $attr)
    {
        $html = '';
        if (isset($attr['options'])) {
            if (!isset($attr['id'])) $attr['id'] = 'txt'.ucfirst($name);
            $html .= static::datalist($attr['id'].'_datalist', $attr['options']);
        }
        $attr['list'] = $attr['id'].'_datalist';
        $html .= $this->input($name, $value, $attr);
        return $html;

    }
102607
public function set_attribute($attr, $value = null)
	{
		$attr = is_array($attr) ? $attr : array($attr => $value);
		foreach ($attr as $key => $value)
		{
			if ($value === null)
			{
				unset($this->attributes[$key]);
			}
			else
			{
				$this->attributes[$key] = $value;
			}
		}

		return $this;
	}
747742
public static function inputTimestamp(string $name = '', $value = 0, array $attributes = []): string
    {
        $defaultAttributes = ['method-get' => false, 'time-controll' => true];
        $userAttributes = \array_merge($defaultAttributes, $attributes);
        $timeControll = $userAttributes['time-controll'];
        $isEnabled = !isset($userAttributes['disabled']);
        $userAttributes = static::clearAttributes($userAttributes, ['time-controll']);
        $timezone = \date_default_timezone_get();

        $nameDate = \sprintf('%s_date', $name);
        $nameTime = \sprintf('%s_time', $name);
        $valDate = $valTime = '';

        if (\is_array($value)) {
            $valDate = $value['date'];
            $valTime = $value['time'];
        } elseif ($value != 0) {
            $valDate = (new \DateTime('@'.$value))->setTimezone(new \DateTimeZone($timezone))->format('Y-m-d');
            $valTime = (new \DateTime('@'.$value))->setTimezone(new \DateTimeZone($timezone))->format('H:i:s');
        }

        $userAttributes['id'] = $nameDate;
        $userAttributes['class'] = 'date';
        $inputDate = Text::inputText($nameDate, $valDate, $userAttributes);

        $userAttributes['id'] = $nameTime;
        $userAttributes['class'] = 'time';
        $inputTime = Text::inputHidden($nameTime, '00:00:00', $userAttributes);

        if ($timeControll === true) {
            $inputTime = Text::inputText($nameTime, $valTime, $userAttributes);
        }

        $btnTitle = static::getConstant(
            'TXT_PANEL_DATA_FORM_TIMESTAMP_CONTROLL_RESET',
            'TXT_PANEL_DATA_FORM_TIMESTAMP_CONTROLL_RESET'
        );
        $resetBtn = $isEnabled ? Tags::span('', ['class' => 'timestamp-reset', 'title' => $btnTitle]) : '';
        $controll = $inputDate.$inputTime.$resetBtn;

        return Tags::div($controll, ['class' => 'timestamp-controll cf']);
    }
75111
public function text($name = null, $value = null, $attr = null)
    {
        return $this->createInput('text', $name, $value, $attr);
    }
891043
public function setAttribute($name, $value = null)
    {
        $name = strtolower($name);
        if (is_null($value)) {
            $value = $name;
        }
        if (in_array($name, $this->watchedAttributes)) {
            $this->onAttributeChange($name, $value);
        } else {
            $this->attributes[$name] = (string)$value;
        }
        return $this;
    }