User login

Allowing regular (short) text fields to use the multiline textarea form widget

There's a module for that now:

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

Field Widget API!modules!field!field.api.php/group/field_widget/8

Searched words: 
drupal 8 allow text widget textarea drupal 8 extend field widget


Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.