protected EntityController::loadBundleDescriptions(array $bundles, EntityTypeInterface $bundle_entity_type)
Expands the bundle information with descriptions, if known.
Parameters
array $bundles: An array of bundle information.
\Drupal\Core\Entity\EntityTypeInterface $bundle_entity_type: The ID of the bundle entity type.
Return value
array The expanded array of bundle information.
File
- core/lib/Drupal/Core/Entity/Controller/EntityController.php, line 309
Class
- EntityController
- Provides the add-page and title callbacks for entities.
Namespace
Drupal\Core\Entity\Controller
Code
protected function loadBundleDescriptions(array $bundles, EntityTypeInterface $bundle_entity_type) {
if (!$bundle_entity_type->isSubclassOf('\Drupal\Core\Entity\EntityDescriptionInterface')) {
return $bundles;
}
$bundle_names = array_keys($bundles);
$storage = $this->entityTypeManager->getStorage($bundle_entity_type->id());
/** @var \Drupal\Core\Entity\EntityDescriptionInterface[] $bundle_entities */
$bundle_entities = $storage->loadMultiple($bundle_names);
foreach ($bundles as $bundle_name => &$bundle_info) {
if (isset($bundle_entities[$bundle_name])) {
$bundle_info['description'] = $bundle_entities[$bundle_name]->getDescription();
}
}
return $bundles;
}
Please login to continue.