diff --git a/core/c/formattributes.php b/core/c/formattributes.php index 0ade6b1..8a52ade 100755 --- a/core/c/formattributes.php +++ b/core/c/formattributes.php @@ -59,7 +59,12 @@ class FormAttributes $this->_element = str_replace(' ID', '', $this->_element); $this->_element = str_replace(' CLASS', '', $this->_element); $this->_element = str_replace(' enctype="ENCTYPE"', '', $this->_element); - $this->_element = str_replace(' checked="CHECKED"', '', $this->_element); + // Only remove checked attribute if it's not set in the attributes + if (!isset($attributes['checked']) || empty($attributes['checked'])) + { + $this->_element = str_replace(' checked="CHECKED"', '', $this->_element); + $this->_element = str_replace(' CHECKED', '', $this->_element); + } $this->_element = str_replace(' onsubmit="ONSUBMIT"', '', $this->_element); $this->_element = str_replace(' onclick="ONCLICK"', '', $this->_element); $this->_element = str_replace(' action="ACTION"', '', $this->_element); @@ -85,8 +90,8 @@ class FormAttributes $this->_element = str_replace(' method="METHOD"', '', $this->_element); $this->_element = str_replace(' data-toggle="DATA-TOGGLE"', '', $this->_element); $this->_element = str_replace(' SELECTED', '', $this->_element); + $this->_element = str_replace(' MULTIPLE', '', $this->_element); $this->_element = str_replace(' CONTEXT', '', $this->_element); - $this->_element = str_replace(' CHECKED', '', $this->_element); $this->_element = str_replace(' VALUE', '', $this->_element); $this->_element = str_replace(' PATTERN', '', $this->_element); $this->_element = str_replace('ANY', '', $this->_element); diff --git a/core/c/typeswitch.php b/core/c/typeswitch.php new file mode 100644 index 0000000..4c4dda2 --- /dev/null +++ b/core/c/typeswitch.php @@ -0,0 +1,44 @@ + '', + self::FORM_ATTRIBUTE_ID => '', + self::FORM_ATTRIBUTE_CLASS => '', + self::FORM_NAME => '', + self::FORM_ATTRIBUTE_CHECKED + ); + + public function loadElement($attributes) + { + parent::__construct($this->_attributes); + $this->_setElement(); + $this->_setAttributes(self::loadAttributeValues($attributes)); + return $this->getElement(); + } + + /** + * @param mixed $element + */ + private function _setElement() + { + $this->_element = '