og_audience field should be locked

Created on 17 July 2025, about 1 month 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.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joelpittet Vancouver
  • ๐Ÿ‡ฌ๐Ÿ‡ง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).

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joelpittet Vancouver
  • ๐Ÿ‡ฎ๐Ÿ‡ฑIsrael amitaibu Israel

    > regardless of field name, without assuming a specific implementation or locking down unused fields.

    ๐Ÿ‘

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom joachim

    I don't think migration is a good reason to keep this sort of flexibility.

    Renaming fields during a migration is a one-time problem. Once it's done, it's over and the complexity of the migration is gone from the system.

    But Having OG need to detect a field of the right type is permanent complexity in the system.

  • ๐Ÿ‡ฎ๐Ÿ‡ฑIsrael amitaibu Israel

    The issue is that you can have one or multiple OG audience fields, but there's no hardcoded 'og_audience' name. It's just a default.

    In that regard, it's similar to any entity reference fields. If you accidentally delete those, you'll also lose functionality. Or @joachim, do you have anything else in mind?

Production build 0.71.5 2024