xref: /dokuwiki/inc/Form/TagOpenElement.php (revision 90fb952c4c30c09c8446076ba05991c89a3f0b01)
164744a10SAndreas Gohr<?php
29d01c1d9SSatoshi Sahara
364744a10SAndreas Gohrnamespace dokuwiki\Form;
464744a10SAndreas Gohr
564744a10SAndreas Gohr/**
664744a10SAndreas Gohr * Class TagOpenElement
764744a10SAndreas Gohr *
864744a10SAndreas Gohr * Creates an open HTML tag. You have to make sure you close it
964744a10SAndreas Gohr * again or this will produce invalid HTML
1064744a10SAndreas Gohr *
1164744a10SAndreas Gohr * @package dokuwiki\Form
1264744a10SAndreas Gohr */
139d01c1d9SSatoshi Saharaclass TagOpenElement extends ValueElement
149d01c1d9SSatoshi Sahara{
1564744a10SAndreas Gohr    /**
1664744a10SAndreas Gohr     * @param string $tag
1764744a10SAndreas Gohr     * @param array $attributes
1864744a10SAndreas Gohr     */
19*6fd0861fSAndreas Gohr    public function __construct($tag, $attributes = [])
209d01c1d9SSatoshi Sahara    {
2164744a10SAndreas Gohr        parent::__construct('tagopen', $tag, $attributes);
2264744a10SAndreas Gohr    }
2364744a10SAndreas Gohr
2464744a10SAndreas Gohr    /**
2564744a10SAndreas Gohr     * The HTML representation of this element
2664744a10SAndreas Gohr     *
2764744a10SAndreas Gohr     * @return string
2864744a10SAndreas Gohr     */
299d01c1d9SSatoshi Sahara    public function toHTML()
309d01c1d9SSatoshi Sahara    {
3164744a10SAndreas Gohr        return '<' . $this->val() . ' ' . buildAttributes($this->attrs()) . '>';
3264744a10SAndreas Gohr    }
3364744a10SAndreas Gohr}
34