Field type plugin description is assumed to be an array

Created on 17 January 2024, 10 months ago
Updated 15 February 2024, 9 months ago

Problem/Motivation

Make field selection less overwhelming by introducing groups Fixed introduced a bug where if a field type plugin's annotation defines description as a single element, it's now entirely hidden from the UI. The code assumes the description is an array and tries to render it as an item_list. But it's entirely reasonable to have a 1-liner description for your field type. I noticed this while

Steps to reproduce

This is slightly convoluted for now, but here's what I did:

  1. Install a 10.2.x-dev core test site.
  2. Install address 2.0.x-dev.
  3. Patch your copy with the latest address code from the MR @ 🐛 Using a translatable string as a category for field type is deprecated in drupal:10.2 Needs work to get the new field category stuff.
  4. Visit admin/structure/types/manage/article/fields/add-field
  5. Click on the "Address" field category.
  6. See radios for 3 specific field types in the category, but no descriptions.
  7. Look at modules/contrib/address/src/Plugin/Field/FieldType/* and verify that all the field types define a descripion.

Proposed resolution

In core/modules/field_ui/src/Form/FieldStorageAddForm.php, inside buildForm() check the type of the description we get back from the plugin manager. If it's an array, do what we do now. If not, print it directly.

Remaining tasks

User interface changes

Field types that belong to a category but only have 1-line descriptions will once again display those descriptions when you're trying to decide what field to add to a given entity type / bundle.

API changes

None.

Data model changes

None.

Release notes snippet

Probably not needed.

🐛 Bug report
Status

Fixed

Version

10.2

Component
Field UI 

Last updated 17 days ago

Created by

🇺🇸United States dww

Live updates comments and jobs are added and updated live.
  • Regression

    It restores functionality that was present in earlier versions.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024