public function KanbanService::getEntityTypeConfigs in Content Planner 8
Get Entity Type Configs.
Parameters
array $entityTypes: An array with the available entity types and their bundles.
Return value
\Drupal\content_kanban\EntityTypeConfig[] Returns an array with the entity type configs.
File
- modules/
content_kanban/ src/ KanbanService.php, line 148
Class
- KanbanService
- Class KanbanService.
Namespace
Drupal\content_kanbanCode
public function getEntityTypeConfigs(array $entityTypes = []) {
$entityTypeConfigs = [];
$color_index = 0;
foreach ($entityTypes as $entityTypeId => $entityBundles) {
foreach ($entityBundles as $bundle) {
$entityTypeConfigs[$bundle] = new EntityTypeConfig($entityTypeId, $bundle, ucfirst($bundle), $this
->getColor($color_index));
$color_index++;
}
}
// Override defined colors with colors from Content Calendar.
if ($this
->useContentCalendarColors()) {
// Load Content Type configs from Content Calendar.
$content_type_configs = $this->contentTypConfigService
->loadAllEntities();
// Overwrite colors.
foreach ($content_type_configs as $content_type => $content_type_config) {
if (array_key_exists($content_type, $entityTypeConfigs)) {
$entityTypeConfigs[$content_type]
->setColor($content_type_config
->getColor());
}
}
}
return $entityTypeConfigs;
}