Locked fields can change the widget but not settings

Created on 21 May 2010, over 14 years ago
Updated 30 March 2023, over 1 year ago

Updated: Comment #25

Problem/Motivation

I've been implementing locked fields on Drupal Commerce entities in modules to do things like have default price fields on products and a default line item reference field on orders. This is great, because I don't want these fields to be deletable.
However, I then discovered the side effect that these fields' settings could not be altered. I figured I'd deal with that when I discovered that yea though settings can't be adjusted, the widget for the locked field can be changed. The problem is different widgets have different settings for the same field, and one widget's default settings won't make any sense to another widget.

Proposed resolution

I can see maybe three quick solutions here (I'm sure there are other options) but need input from those in the know:

  1. Don't allow locked field instance widgets to be changed.
  2. Allow settings for locked fields to be adjusted but do not allow locked fields to be deleted.
  3. Introduce a multi-level lock so a field could be either non-deletable but alterable or non-deletable and non-alterable.

Remaining tasks

Patch needs review.

User interface changes

As mentioned above.

API changes

None.

Original report by rszrama

🐛 Bug report
Status

Needs work

Version

9.5

Component
Field 

Last updated about 13 hours ago

Created by

🇺🇸United States rszrama

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

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