IchHabRecht / mask_export

Export your mask elements as extension
GNU General Public License v2.0
45 stars 27 forks source link

Resolving of Backend template names is not correct for content elements with underscore in name #139

Closed CarlosAgrelis closed 6 years ago

CarlosAgrelis commented 6 years ago

mask.json

{
    "tt_content": {
        "elements": {
            "test_element": {
                "color": "#000000",
                "columns": [
                    "tx_mask_name_test"
                ],
                "description": "Element with \"_\" in name",
                "icon": "",
                "key": "test_element",
                "label": "Test Element",
                "labels": [
                    "Name Test"
                ],
                "shortLabel": "Test Element"
            }
        },
        "sql": {
            "tx_mask_name_test": {
                "tt_content": {
                    "tx_mask_name_test": "tinytext"
                }
            }
        },
        "tca": {
            "tx_mask_name_test": {
                "config": {
                    "default": "",
                    "eval": "required,trim",
                    "is_in": "",
                    "max": "",
                    "placeholder": "",
                    "size": "",
                    "type": "input"
                },
                "exclude": "1",
                "key": "name_test"
            }
        }
    }
}

When this is exported, installed and activated. And one element is set on the page in the backend. This error is shown: image

Problem is mask_export/Classes/Aggregate/BackendPreviewAggregate.php line 216:

216            \$this->view->setTemplate(ucfirst(\$this->supportedContentTypes[\$contentType]));

Suggested solution:

216            \$this->view->setTemplate(GeneralUtility::underscoredToUpperCamelCase(\$this->supportedContentTypes[\$contentType]));