WIP: Implement crm selections

This commit is contained in:
Björn Fromme
2023-10-11 14:35:40 +02:00
parent 7084e1528e
commit b472dab6c8
6 changed files with 103 additions and 5 deletions
@@ -55,4 +55,25 @@ class CrmAttributesResponse
return $this;
}
public function toArray(): array
{
$crmSelections = [];
foreach ($this->getAttributeGroups() as $group) {
/** @var CrmAttributeGroup $group */
if (false === isset($crmSelections[$group->getLabel()])) {
$crmSelections[$group->getLabel()] = [];
}
foreach ($group->getAttributes() as $attribute) {
/** @var CrmAttribute $attribute */
if (false === $attribute->isSelected()) {
continue;
}
$crmSelections[$group->getLabel()][] = $attribute->getLabel();
}
}
return $crmSelections;
}
}