By catch on
Change record status:
Draft (View all draft change records)
Project:
Introduced in branch:
main
Introduced in version:
11.6.x
Issue links:
Description:
A ::getFieldBundles() method has been added to EntityFieldManagerInterface, this can be used instead of getting the raw data structure from the field map.
Before:
$map = \Drupal::service('entity_field.manager')->getFieldMap();
if (isset($map[$this->getTargetEntityTypeId()][$this->getName()]['bundles'])) {
return $map[$this->getTargetEntityTypeId()][$this->getName()]['bundles'];
}
After:
$entity_field_manager = \Drupal::service('entity_field.manager');
return $entity_field_manager->getFieldBundles($this->getTargetEntityTypeId(), $this->field_name);
}
Impacts:
Module developers