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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ChristianAdamski created an issue. See original summary.

ChristianAdamski’s picture

Issue summary: View changes
ChristianAdamski’s picture

Added test

Should fail

ChristianAdamski’s picture

Whole 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)

ChristianAdamski’s picture

Interesting, 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.

Status: Needs review » Needs work

The last submitted patch, 5: 2835738-5-test-only-field-ui.patch, failed testing.

ChristianAdamski’s picture

Status: Needs work » Needs review
FileSize
7.08 KB

And this should work

dawehner’s picture

Status: Needs review » Fixed

I 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

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.