protected function loadExtraFields(): array
{ // Read from the persistent cache. Since hook_entity_extra_field_info() and
// hook_entity_extra_field_info_alter() might contain t() calls, we cache
// per language.
$cache_id = 'entity_extra_field_info:' .
$this->languageManager->
getCurrentLanguage()->
getId();
$cached =
$this->
cacheGet($cache_id);
if ($cached) { return $cached->data;
} $extra =
$this->moduleHandler->
invokeAll('entity_extra_field_info'
);
$this->moduleHandler->
alter('entity_extra_field_info',
$extra);
// Apply default values to each bundle.
foreach ($extra as $entity_type_id =>
$extra_fields_by_bundle) { foreach ($extra_fields_by_bundle as $bundle =>
$bundle_extra_fields) { $extra[$entity_type_id][$bundle] +=
[ 'form' =>
[],
'display' =>
[],
];
} }