Skip to content

Commit

Permalink
Don't expose ECK entities without subtypes to afform
Browse files Browse the repository at this point in the history
  • Loading branch information
jensschuppe committed Nov 14, 2024
1 parent 3d435db commit f0601ad
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Civi/Eck/API/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ public function onApi4EntityTypes(GenericHookEvent $event): void {
*/
public static function afformEntityTypes(GenericHookEvent $e): void {
foreach (\CRM_Eck_BAO_EckEntityType::getEntityTypes() as $entityType) {
$e->entities[$entityType['entity_name']] = [
'entity' => $entityType['entity_name'],
'label' => $entityType['label'],
'icon' => $entityType['icon'],
'type' => 'primary',
'defaults' => '{}',
];
if ([] !== \CRM_Eck_BAO_EckEntityType::getSubTypes($entityType['name'])) {
$e->entities[$entityType['entity_name']] = [
'entity' => $entityType['entity_name'],
'label' => $entityType['label'],
'icon' => $entityType['icon'],
'type' => 'primary',
'defaults' => '{}',
];
}
}
}

Expand Down

0 comments on commit f0601ad

Please sign in to comment.