Using a translatable string as a category for field type is deprecated

Created on 13 February 2024, 4 months ago
Updated 13 June 2024, 11 days ago

Problem/Motivation

As per https://www.drupal.org/node/3375748 β†’ , usage of translatable string for field type definition category is deprecated.

Steps to reproduce

Check the ViewsReferenceItem class annotation:

/**
 * Defines the 'viewsreference' entity field type.
 *
 * The target type for viewsreference fields should always be 'view'.
 *
 * @FieldType(
 *   id = "viewsreference",
 *   label = @Translation("Views reference"),
 *   description = @Translation("A field reference to a view."),
 *   category = @Translation("Reference"),
 *   default_widget = "viewsreference_autocomplete",
 *   default_formatter = "viewsreference_formatter",
 *   list_class = "\Drupal\viewsreference\Plugin\Field\ViewsReferenceFieldItemList",
 * )
 */

Proposed resolution

Replace the translated category property with:
category = "reference",

Remaining tasks

Fix and commit.

User interface changes

The Views Reference field type will appear under Reference category in new field creation UI.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine abramm Lutsk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024