[BUGFIX] EXT:form - accept-charset in form not working 55/44955/4
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Thu, 26 Nov 2015 12:44:29 +0000 (13:44 +0100)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Fri, 27 Nov 2015 16:09:29 +0000 (17:09 +0100)
Let the wizard write the correct attribute name "accept-charset"
instead of "acceptcharset". Avoid non existing attribute-class loading
if an attribute name contains non-alphabetic characters.

Resolves: #62713
Releases: 6.2
Change-Id: Iaadf8829b40a39061665dcea529f44ccf2d0a294
Reviewed-on: https://review.typo3.org/44955
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/form/Classes/Domain/Model/Attribute/AcceptCharsetAttribute.php
typo3/sysext/form/Classes/Domain/Model/Attribute/AttributesAttribute.php
typo3/sysext/form/Configuration/PageTS/modWizards.ts
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Form.js
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Attributes.js

index ba32c01..53e5e03 100644 (file)
@@ -15,7 +15,7 @@ namespace TYPO3\CMS\Form\Domain\Model\Attribute;
  */
 
 /**
- * Attribute 'acceptcharset'
+ * Attribute 'accept-charset'
  *
  * @author Patrick Broens <patrick@patrickbroens.nl>
  */
index b5608b9..9efec5d 100644 (file)
@@ -63,9 +63,10 @@ class AttributesAttribute {
         * @return tx_form_Domain_Model_Attributes
         */
        public function addAttribute($class, $value) {
-               $class = strtolower((string) $class);
-               $className = 'TYPO3\\CMS\\Form\\Domain\\Model\\Attribute\\' . ucfirst($class) . 'Attribute';
-               $this->attributes[$class] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $value, $this->elementId);
+               $attributeName = strtolower((string) $class);
+               $cleanClassName = str_replace(' ', '', ucwords(preg_replace("/[^a-z]/", ' ', $attributeName)));
+               $className = 'TYPO3\\CMS\\Form\\Domain\\Model\\Attribute\\' . $cleanClassName . 'Attribute';
+               $this->attributes[$attributeName] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $value, $this->elementId);
                return $this;
        }
 
index 5e4bcf5..b46aedd 100644 (file)
@@ -34,7 +34,7 @@ prefix = tx_form
                                        showAccordions = legend, label, attributes, options, validation, filters, various
                                        accordions {
                                                attributes {
-                                                       showProperties = accept, acceptcharset, accesskey, action, alt, checked, class, cols, dir, disabled, enctype, id, label, lang, maxlength, method, multiple, name, readonly, rows, selected, size, src, style, tabindex, title, type, value
+                                                       showProperties = accept, accept-charset, accesskey, action, alt, checked, class, cols, dir, disabled, enctype, id, label, lang, maxlength, method, multiple, name, readonly, rows, selected, size, src, style, tabindex, title, type, value
                                                }
                                                label {
                                                        showProperties = label
@@ -151,7 +151,7 @@ prefix = tx_form
                                        showAccordions = behaviour, prefix, attributes, postProcessor
                                        accordions {
                                                attributes {
-                                                       showProperties = accept, acceptcharset, action, class, dir, enctype, id, lang, method, name, style, title
+                                                       showProperties = accept, accept-charset, action, class, dir, enctype, id, lang, method, name, style, title
                                                }
                                                postProcessor {
                                                        showPostProcessors = mail, redirect
index 7658355..2c41d35 100644 (file)
@@ -72,7 +72,7 @@ TYPO3.Form.Wizard.Elements.Basic.Form = Ext.extend(TYPO3.Form.Wizard.Elements, {
                        configuration: {
                                attributes: {
                                        accept: '',
-                                       acceptcharset: '',
+                                       "accept-charset": '',
                                        action: '',
                                        "class": '',
                                        dir: '',
index 160b22b..7e7cc4a 100644 (file)
@@ -72,10 +72,10 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                                                }
                                        });
                                        break;
-                               case 'acceptcharset':
+                               case 'accept-charset':
                                        formItems.push({
                                                fieldLabel: TYPO3.l10n.localize('attributes_acceptcharset'),
-                                               name: 'acceptcharset',
+                                               name: 'accept-charset',
                                                listeners: {
                                                        'triggerclick': {
                                                                scope: this,
@@ -580,7 +580,7 @@ TYPO3.Form.Wizard.Viewport.Left.Options.Forms.Attributes = Ext.extend(Ext.FormPa
                        // The object has not been found or constructed wrong
                        allowedGeneralAttributes = [
                                'accept',
-                               'acceptcharset',
+                               'accept-charset',
                                'accesskey',
                                'action',
                                'alt',