while the steps to create a custom content element are quite straight forward it still requires duplicate definitions. I understand that some things have to be configured at different locations (TS, tt_content.php, …), yet there are parts that can and should be simplified in my opinion. So, convention over configuration. Following things I would like to simplify:
Definition of the Icon at one location, but not three or even more
1.1 Either configure it once. For example in TCA
1.2 It is expected to be located at a specific path. For example ext:my_ext/Resources/Icons/CType/ctype-name.svg
Add the keys “label” and “description” to CType definition, which is used whereever these data are required and defined at the moment.
Simplify the CType - addTcaSelectItem process
3.1 For example by adding a helper method which figures out the icon and label by itself.
ExtensionManagementUtility::addCTypeSelectItem(‘new-ctype-name’, ‘textmedia’, ‘after’);
Simplify PageTS. Currently we define the icon and title here as well and we need to define the defValue CType here. We have defined them in the TCA, Overrides/tt_content.php already and it’s obvious which CType should be set here. So, I don’t see a reason why we should provide it.
I am looking forward for your feedback and if there are certain decisions why it has been implemented like that and therefore should not be changed, let me know