- Issue created by @mxh
- 🇩🇪Germany mxh Offenburg
Ok, so it turns out that using "After build" is the proper event for such a case, because that's the only opportunity to change built up render arrays after all '#process' callbacks were executed by the form builder service.
What's missing for the "Form field: set as disabled" action is, that the form builder does set HTML attributes right after the '#process' callbacks were executed, and after that it calls defined '#after_build' callbacks. That leads to the unfortunate situation, that the field is not being disabled by the proper HTML attributes when using "After build". At least for that, I could add a helper method to the according action plugin, that manually takes care for that. Providing an MR containing the helper method.
There is one more problem though: The CKeditor element is always enabled, regardless when the form element was set to be disabled with
$element['#disabled'] = TRUE;
. This seems to be a core bug 🐛 ckeditor can't be set enabled / disabled / readonly by Form API #states Active
We could consider providing a special treatment for CKEditor, or we forward this to a core issue, or at least treat this as a separate issue besides this one.
Conclusion for CKeditor plugins: for the moment, there is no way at all to disable it. Luckily it's still possible to completely hide the field using "Form field: set access".Conclusion for the "After build" event: It may be more usable than originally thought. This may be appended in the ecaguide.org documentation, as others will probably also encounter this situation.
- last update
over 1 year ago 284 pass - @mxh opened merge request.
- Status changed to Needs review
over 1 year ago 5:37pm 30 April 2023 - Status changed to RTBC
over 1 year ago 9:02am 1 May 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
This sounds like a deja vue as we ran into something related with CyPress tests where we wanted to assert, if the body field was empty. That failed, because the textarea html element is in the markup, but hidden. And the widget (CKEditor in this case) is a sibling div container to that textarea which does all the content editing input. Only when the form gets submitted is the value for the textarea being populated by javascript.
Similar issues have been seen for the select2 drop-down widget, where javascript builds a widget next to the original form API element coming from Drupal.
I'm commenting on this here because I assume that this behaviour is why disabling such fields that get special widgets won't be possible.
The MR as such is looking good and will be committed.
- last update
over 1 year ago 284 pass -
jurgenhaas →
committed 6c9175d5 on 1.2.x authored by
mxh →
Issue #3357328 by mxh: eca_form: "Form field: set as disabled" not...
-
jurgenhaas →
committed 6c9175d5 on 1.2.x authored by
mxh →
-
jurgenhaas →
committed 863d3826 on 1.1.x authored by
mxh →
Issue #3357328 by mxh: eca_form: "Form field: set as disabled" not...
-
jurgenhaas →
committed 863d3826 on 1.1.x authored by
mxh →
- Status changed to Fixed
over 1 year ago 9:35am 1 May 2023 Automatically closed - issue fixed for 2 weeks with no activity.