As per existing code in src/WidgetSettings.php
// @todo: find a more flexible way to specify these settings, not hardcoded
Motivation
We use a custom text area widget to always display the summary and similar minor changes. I would like to use the maxlength functionality there as well, which should be no problem as its simply derived from the 'text_textarea_with_summary' widget. But I can't because of the hardcoded list of widget IDs.
Change
Add a hook to add additional widget IDs.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2835738-7-custom-widget-full.patch | 7.08 KB | christianadamski |
| #5 | 2835738-5-test-only-field-ui.patch | 5.48 KB | christianadamski |
| #4 | 2835738-4-custom-widget-support.patch | 6.43 KB | christianadamski |
| #3 | 2835738-3-custom-widget-support-test-only.patch | 4.83 KB | christianadamski |
Comments
Comment #2
christianadamski commentedComment #3
christianadamski commentedAdded test
Should fail
Comment #4
christianadamski commentedWhole patch:
- added "hook_maxlength_widget_settings()"
- added api.php file with that hook
- altered WidgetSettings.php to invoke said hook
and
- above test (which took way longer than the other stuff)
Comment #5
christianadamski commentedInteresting, so if the maxlength/maxlength_js settings re there, no matter how, they are used, even if the widget is not registered in the WidgetSettings.
- updated test to actually interact with the field UI to set values for maxlength and check them being present in the widget settings summary afterwards
This should fail.
Comment #7
christianadamski commentedAnd this should work
Comment #9
dawehnerI couldn't think of a better non crazy implementation. In case we find one, we can always go to maxlength 2.x or even later.
Thank you for the patch. I commited and pushed it to 8.x-1.x