Compute "seconds" field in Field API preSave() rather than in widget form to play nice with API-based consumers

Created on 7 October 2019, about 5 years ago
Updated 5 June 2024, 7 months ago

The "seconds" fields of the duration field is supposed to be computed from the ISO8601 duration string in the "duration" field.

Currently, it's done in a form callback when submitting the value on the node edit form. This means that when "duration" field is updated through another mean, the "seconds" field won't be updated.

Those other means can be JSON:API, REST, GraphQL ... or another widget.

It would be better to transfer this concern to the Field API itself, using preSave() so that it performs the same in all cases.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada garphy

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024