Problem/Motivation

Currently new fields don't appear under data from field widget until the cache is rebuilded

Proposed resolution

Trigger a cache delete on add field.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

christian.wiedemann created an issue. See original summary.

christian.wiedemann’s picture

Title: [2.0.x beta2] New fields don't appear in Data from a field until cache rebuild » [2.0.0-beta2] New fields don't appear in Data from a field until cache rebuild

christian.wiedemann’s picture

Assigned: christian.wiedemann » just_like_good_vibes
Status: Active » Needs review
christian.wiedemann’s picture

I borrowed the logic from layout builder. I am currently clearing the cache from SourcePluginManager and DerivableContextPluginManager.
Is it enough?

just_like_good_vibes’s picture

why this in the code ? because we also borrow the sample entity gen?

// Clear the sample entity for this entity type and bundle.
...

i am not sure about the hook used, because there are related to field_config.

and by the way, the hooks are hook_ENTITY_TYPE_delete and hook_ENTITY_TYPE_insert ?

when the config already exist and only a field instance is added/removed, is it still ok?

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » christian.wiedemann
Status: Needs review » Needs work
christian.wiedemann’s picture

Assigned: christian.wiedemann » just_like_good_vibes
Status: Needs work » Needs review
christian.wiedemann’s picture

I checked the hooks. They are working in both cases. For adding new fields and with existings fields.

Your question "and by the way, the hooks are hook_ENTITY_TYPE_delete and hook_ENTITY_TYPE_insert ?"
The hooks are right. Not 100% what you mean.

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Needs review » Fixed
pdureau’s picture

Status: Fixed » Closed (fixed)
christian.wiedemann’s picture