Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::mainPropertyName() should return NULL

Created on 12 October 2023, about 1 year ago
Updated 6 December 2023, 12 months ago

Problem/Motivation

The Date range field type(daterange) actually requires both properties value and end_value, but it inherits the mainPropertyName method from Drupal\Core\Field\FieldItemBase, which returns value as the main property. It doesn't make sense for this field type, and may cause confusion for code using this method.

Steps to reproduce

Proposed resolution

As specified by the documentation of the method *mainPropertyName*

Returns the name of the main property, if any.

Some field items consist mainly of one main property, e.g. the value of a text field or the target_id of an entity reference. If the field item has no main property, the method returns NULL.

For daterange field type, this method should returns NULL.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Datetime 

Last updated 3 days ago

Created by

🇩🇪Germany qichanghai Munich

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024