Problem/Motivation
Config fields are split between two classes:
- FieldConfigBase, in the Field core component
- FieldConfig, which inherits from it, in the field module.
FieldConfigBase handles clearing caches on save, in postSave():
// Clear the cache.
\Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
However, for deleting a field, it's in FieldConfig::postDelete():
// Clear the cache upfront, to refresh the results of getBundles().
\Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
// Notify the entity storage.
foreach ($fields as $field) {
if (!$field->deleted) {
\Drupal::service('field_definition.listener')->onFieldDefinitionDelete($field);
}
}
This part of the code in postDelete() should be moved up to the parent class for consistency.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
joaopauloc.dev commentedComment #3
joaopauloc.dev commentedComment #4
smustgrave commentedSeems like a simple clean up.
Only question for committer does this need a CR? Doubt it but wanted to make sure.
Comment #6
catchDon't think we need a CR for this one, but will only commit to 10.1.x.
Committed/pushed to 10.1.x, thanks!