Fatal error when the unit is not a dropdown

Created on 9 June 2023, over 1 year ago

Problem/Motivation

The issue is the occasionally the module writes human-readable unit to the database (m³), instead of m3, so it results in a fatal error at the node edit page:

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: Invalid volume unit "m³" provided. in Drupal\physical\VolumeUnit::assertExists() (line 80 of modules/contrib/physical/src/VolumeUnit.php). 

Steps to reproduce

- Create a new content-type
- Add a Physical field, Measurement, Volume, only "m3" allowed, user not allowed to change
- Create a new node with a value in that field
- Visit node/[nid]/edit

Proposed resolution

Alter the processElement to avoid writing the label to the database.

Remaining tasks

None

User interface changes

None.

API changes

None.

Data model changes

None, existing sites with bogus data might need update hooks to get rid of bogus data.

🐛 Bug report
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇭🇺Hungary Aron Novak Hungary, Budapest

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

Comments & Activities

Production build 0.71.5 2024