public function CreateTemplateForm::getBundles in GatherContent 8.5
Get list of bundle types.
Parameters
string $entityType: Entity type ID.
Return value
array Assoc array of bundle types.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
1 call to CreateTemplateForm::getBundles()
- CreateTemplateForm::buildForm in gathercontent_upload_ui/
src/ Form/ CreateTemplateForm.php - Form constructor.
File
- gathercontent_upload_ui/
src/ Form/ CreateTemplateForm.php, line 156
Class
Namespace
Drupal\gathercontent_upload_ui\FormCode
public function getBundles(string $entityType) : array {
$mappingStorage = $this->entityTypeManager
->getStorage('gathercontent_mapping');
$bundleTypes = $this->entityTypeBundleInfo
->getBundleInfo($entityType);
$response = [];
foreach ($bundleTypes as $key => $value) {
$mapping = $mappingStorage
->loadByProperties([
'entity_type' => $entityType,
'content_type' => $key,
]);
if ($mapping) {
continue;
}
$response[$key] = $value['label'];
}
return $response;
}