og_audience field should be locked

Created on 17 July 2025, 5 days ago

Problem/Motivation

The og_audience field is created a a config field.

It should be locked, so it can't be removed by an admin user.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

og.module

Created by

🇬🇧United Kingdom joachim

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

Comments & Activities

  • Issue created by @joachim
  • 🇨🇦Canada joelpittet Vancouver

    I don’t recommend locking the og_audience field in our case.

    While it’s an important default that OG creates when no other og_standard_reference fields exist — and definitely useful for new OG installs — our situation is different. We're migrating from Drupal 7 and already have several specifically named og_standard_reference fields in use. In our case, og_audience has been deleted and is not part of the current architecture.

    Locking it could prevent us from removing or editing the instance/widget settings — for example, to use custom selection handlers. That gives me pause, especially considering the underlying ambiguity around the meaning and enforcement of “locked” in core config entities. Some relevant issues:

    What problem or motivation is behind the request to lock it? Or are you assuming some of the issues above are unlikely to ever be resolved? I believe (though haven’t tested) that removing locked fields via config import might still be possible under current behaviour, but if some of those issues above are resolved that may not be the case in the future.

  • 🇬🇧United Kingdom joachim

    Well, really, I think it should be a code bundle field, but I figured that might be too big a change.

    It needs to be something that can't get deleted by accident, surely, since the module won't work properly without it.

  • 🇨🇦Canada joelpittet Vancouver

    Yeah, I agree — OG requires at least one og_standard_reference field on group content to function properly.

    How about: what if we instead throw a warning on the Field UI and/or Status page if a group content bundle doesn't have any og_standard_reference field defined? That way we’d catch real misconfigurations regardless of field name, without assuming a specific implementation or locking down unused fields.

    That could provide the safety you’re looking for, while still keeping things flexible for cases like ours where the field exists under different names due to migration history (or other pedantic reasons).

Production build 0.71.5 2024