Allowing regular (short) text fields to use the multiline textarea form widget
There's a module for that now: https://www.drupal.org/project/textarea_widget_for_text
It's nice and simple with an alter hook (as detailed on the module page) and in this answer.
What's not so simple is that nothing else about field widgets is done with hooks anymore, so looking in core for examples of how to extend an existing one comes up with nothing. Looking through the API is more fruitful, turning up hook_field_widget_info_alter(&$info).
As explained in the widgets section of this series on Drupal 8's field API, hook_field_widget_info() are now annotations. So it's less than intuitive that hook_field_widget_info_alter() is still around, and that's how you extend a plugin's annotations.
But, that's the way it is.
See also
Field widgets are now plugins
https://www.drupal.org/node/1796000
Field Widget API
https://api.drupal.org/api/drupal/core!modules!field!field.api.php/group/field_widget/8
Comments
Post new comment