Makes a <FORM> tag

@param array  $attributes
@param string $value
@param bool   $close If true, tag will be closed

@return string
183917
public static function form( array $attributes = array(), $value = null, $close = false )
    {
        return static::tag( 'form', $attributes, $value, $close );
    }
226364
public function createElementBySelector($selector, $value = null, array $attributes = [])
    {
        $segments = Query::getSegments($selector);

        $name = array_key_exists('tag', $segments) ? $segments['tag'] : 'div';

        if (array_key_exists('attributes', $segments)) {
            $attributes = array_merge($attributes, $segments['attributes']);
        }

        if (array_key_exists('id', $segments)) {
            $attributes['id'] = $segments['id'];
        }

        if (array_key_exists('classes', $segments)) {
            $attributes['class'] = implode(' ', $segments['classes']);
        }

        return $this->createElement($name, $value, $attributes);
    }
583703
public static function createTag($tag, $attributes, $content = null)
    {
        $tag = strtolower($tag);

        // Build list of arguments
        $preparedAttributes = '';
        foreach ($attributes as $attributeKey => $attributeValue) {
            // Only set non-empty strings (ensures strlen(0) > 0)
            if (strlen($attributeValue) > 0) {
                $preparedAttributes .= sprintf(
                    ' %s="%s"',
                    $attributeKey,
                    Convert::raw2att($attributeValue)
                );
            }
        }

        // Check void element type
        if (in_array($tag, static::config()->get('void_elements'))) {
            if ($content) {
                throw new InvalidArgumentException("Void element \"{$tag}\" cannot have content");
            }
            return "<{$tag}{$preparedAttributes} />";
        }

        // Closed tag type
        return "<{$tag}{$preparedAttributes}>{$content}</{$tag}>";
    }
1218730
public function button($value, $name = null, $attributes = array())
    {
        $name = pick($name, $value);

        return $this->tag('button', $value)
                    ->set(array('id' => $name, 'name' => $name))
                    ->set($attributes);
    }
532718
public function radio($name, $value = '', $checked = false, $attributes = array())
    {
        if ($checked) {
            $attributes['checked'] = 'checked';
        } else {
            unset($attributes['checked']);
        }

        return $this->input('radio', $name, $value, $attributes);
    }
225577
public static function textarea( array $attributes = array(), $value = null, $wrapper = null )
    {
        $_html = static::tag( 'textarea', $attributes, $value );

        if ( null !== $wrapper )
        {
            $_html = static::div( array('class' => $wrapper), $_html );
        }

        return $_html;
    }
1068044
public static function file( array $attributes = array(), $value = null, $wrapper = null )
    {
        $attributes['type'] = 'file';

        return static::input( $attributes, $value, $wrapper );
    }
796325
public function begin_tag($tag, $attributes = null) {
        // TODO: chek the tag name is valid
        $pre = $this->level ? "\n" . str_repeat(' ', $this->level * 2) : ''; // Indent
        $tag = $this->casefolding ? strtoupper($tag) : $tag; // Follow casefolding
        $end = $this->nullcontent ? ' /' : ''; // Tag without content, close it

        // Build attributes output
        $attrstring = '';
        if (!empty($attributes) && is_array($attributes)) {
            // TODO: check the attr name is valid
            foreach ($attributes as $name => $value) {
                $name = $this->casefolding ? strtoupper($name) : $name; // Follow casefolding
                $attrstring .= ' ' . $name . '="'.
                    $this->xml_safe_attr_content($value) . '"';
            }
        }

        // Optional xml schema definition (level 0 only)
        $schemastring = '';
        if ($this->level == 0 && !empty($this->xmlschema)) {
            $schemastring .= "\n    " . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' .
                             "\n    " . 'xsi:noNamespaceSchemaLocation="' . $this->xml_safe_attr_content($this->xmlschema) . '"';
        }

        // Send to xml_output
        $this->write($pre . '<' . $tag . $attrstring . $schemastring . $end . '>');

        // Acumulate the tag and inc level
        if (!$this->nullcontent) {
            array_push($this->opentags, $tag);
            $this->level++;
        }
        $this->lastwastext = false;
    }
453743
public static function date($name, $value, array $attributes = array())
    {
        $node = new Node\Date();

        if (!is_null($name)) {
            $attributes['name'] = $name;
        }

        if (!is_null($value)) {
            $attributes['value'] = $value;
        }

        return $node->render($attributes);
    }
755450
public function setAttributes(array $attributes) : Tag
    {
        foreach ($attributes as $name => $value) {
            $this->attributes[strtolower($name)] = (string) $value;
        }

        return $this;
    }
1066892
public function attribute( string $attr, string $value ): Tag
    {
        $this->attributes[$attr] = $value;

        return $this;
    }
987677
public static function create(string $tag, string $content = null, array $attributes = null,
        bool $selfClosing = false, bool $v5 = true): string
    {
        if ($attributes != null) {
            $tmp = [];
            foreach ($attributes as $name => $value) {
                if ($value === null) { // eg: ['a' => 1, 'b' => null, ...]
                    $tmp[] = $name;
                } elseif (is_int($name)) { // eg: ['a' => 1, 'b', ...]
                    $tmp[] = $value;
                } else { // eg: ['a' => 1, 'b' => 2, ...]
                    $tmp[] = sprintf('%s="%s"', $name, strtr((string) $value, ['"' => '&quot;']));
                }
            }
            $attributes = ' '. join(' ', $tmp);
        }

        return $selfClosing || in_array($tag, self::$selfClosingTags)
            ? sprintf('<%s%s%s>', $tag, $attributes, $v5 ? '' : ' /')
            : sprintf('<%s%s>%s</%s>', $tag, $attributes, $content, $tag);
    }
988204
public function open($url, array $attributes = [])
    {
        $tag = new Tag('form', $attributes);
        $tag->action = $url;
        $tag->method = 'POST';
        return $tag;
    }
4483
public function tag($tag, $attr = null, $content = null, $close = false)
    {
        $tag = strtolower($tag);

        if (! empty($attr) && is_array($attr)) {
            $attr = $this->Attr->attr($attr);
        }

        if ($close) {
            return sprintf('<%s%s>%s</%1$s>', $tag, $attr, $content);
        } else {
            return sprintf('<%s%s>', $tag, $attr);
        }
    }
323366
public function full_tag($tag, $content = null, $attributes = null) {
        $content = $this->text_content($content); // First of all, apply transformations
        $this->nullcontent = is_null($content) ? true : false; // Is it null content
        $this->begin_tag($tag, $attributes);
        if (!$this->nullcontent) {
            $this->write($content);
            $this->lastwastext = true;
            $this->end_tag($tag);
        }
    }
847025
public function input($type, $name, $value = null, array $attributes = [])
    {
        $tag = new Tag('input', $attributes);
        $tag->type = $type;
        $tag->name = $name;
        $tag->value = $value;
        return $tag;
    }
708061
protected function getAttachId($key, $value, array $attributes)
	{
		if (is_array($value))
		{
			return array($key, array_merge($value, $attributes));
		}
		else
		{
			return array($value, $attributes);
		}
	}