Widget
Drupal uses the word widget for the input control of one field on an edit form, set on Manage form display. Pieces placed in page regions are blocks.
In Drupal, a widget is a field widget: the form control that an editor uses to enter the data of a field. The Drupal User Guide defines it as the method used to enter the data for the field. Core widgets include a text box, a select list, a checkbox and an autocomplete.
What the word means in Drupal 11
Widgets belong to the editing side of a field. You choose one per field and per form mode, and you can set its options, hide it or reorder it. The same data can be entered in different ways. The user guide's example is a taxonomy term field, which can use an autocomplete field, a select list or a tags-style field. In core, a widget is a plugin that builds Form API elements and adds processing for field values. The page on field widgets covers the plugin details.
Other words are easy to confuse with it:
| Term | What it is | Where you set it |
|---|---|---|
| Widget | The input control for a field on an edit form | Manage form display |
| Field formatter | The output of a field when the entity is displayed | Manage display |
| Block | A piece of page layout in a theme region | Block layout |
Example
A Recipe content type has an Ingredients field that points to taxonomy terms. On the edit form, an editor sees one input for each ingredient. Under Structure › Content types, open the menu beside Recipe and choose Manage form display. After you select Autocomplete (Tags style) as the widget for Ingredients and save, the editor types several ingredients into a single text field. It is still the same field; only the way editors enter its values changed.
Common mistakes
- Looking for widgets on the Block layout page. That page places blocks in regions. A widget lives on an edit form.
- Expecting a widget to change the public page. Output belongs to the formatter, which is a separate setting.
- Choosing a widget to fix a data problem. A widget changes how editors enter a value. If the field holds the wrong kind of data, the field type is the problem.
For marketing and content teams
When an editing form feels slow or awkward, the widget can be the setting to change. A site builder switches it on Manage form display. Describe the pain in plain words ("I want to type all tags in one line") and the site builder can pick a matching widget.
With DXPR
If you came looking for the pieces you drop onto a page, those are blocks in Drupal. In DXPR Builder, the pieces you place are elements; an empty builder field starts with an Add Elements button. See DXPR Builder.
Sources
- Drupal User Guide: Concept: Forms and Widgets
- Drupal User Guide: Changing Content Entry Forms
- Drupal User Guide: Concept: Blocks
- Drupal core 11.4.8: Field Widget API topic (field.api.php)
- Drupal core 11.4.8: Field UI help text (FieldUiHooks.php)
- Drupal core 11.4.8: core field widget plugins
- DXPR Builder: Use DXPR Builder on your content types