Details
-
Bug
-
Resolution: Fixed
-
High
-
2.3.2
-
None
Description
Hello,
Customer is asking how to customize some edit form fields when editing a Content of a specific ContentType (let's say article for example).
In legacy this was done by something like:
[edit_article_title] Source=content/datatype/edit/ezstring.tpl MatchFile=content/datatype/edit/article_title.tpl Match[class_identifier]=article Match[attribute_identifier]=title
According to me (but I'm maybe missing something here), this could be easily done using the ViewProvider on the content_edit_view with a specific `form_templates` parameter. This form_templates parameter is an array of templates' paths and will be used to define the form_theme with the `default_form_templates`. This is done here : https://github.com/ezsystems/ezplatform-admin-ui/blob/master/src/bundle/Resources/views/content/content_edit/content_edit_base.html.twig#L4
So to give a concrete example I would have something like this to override some edit form fields for 'Article' Contents :
system: admin_group: content_edit_view: full: ezplatform_admin_ui_article: template: '@ezdesign/content/content_edit/content_edit.html.twig' match: Identifier\ContentType: [article] params: viewbaseLayout: '@ezdesign/layout.html.twig' form_templates: ["@ezdesign/content/content_edit/article_form_fields.html.twig"] ezplatform_admin_ui: template: '@ezdesign/content/content_edit/content_edit.html.twig' match: true params: viewbaseLayout: '@ezdesign/layout.html.twig'
with 'article_form_fields.html.twig' having some specific form fragments to use (pure symfony here, no need to be exposed).
Untill here evrything is ok.
The issue I'm having here is that `form_templates` (here containing 'article_form_fields.html.twig' path) will be merged with the default_form_templates ( see github repo link above ) in a way that custom form templates can't override default form templates :
Actual version :
form_templates|merge(default_form_templates)
(so default_form_templates will be added AFTER form_template in the new array)
Needed version :
default_form_templates|merge(form_templates)
Here our custom form templates will be able to override the standard form templates in the `form_theme` because default form_templates will be BEFORE in the merged array.
And from my understanding and manual tests done, this is not giving side effects on other parts of the admin.
Long story for short fix...
Attachments
Issue Links
- testing discovered
-
EZEE-2574 Cannot read property 'getAttribute' of null while opening block settings in PB
- Closed