Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomAttributesFlattener.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
14 {
21  public function flatten(array $categoryData) : array
22  {
23  if (!isset($categoryData['custom_attributes'])) {
24  return $categoryData;
25  }
26 
27  foreach ($categoryData['custom_attributes'] as $attributeData) {
28  $categoryData[$attributeData['attribute_code']] = $attributeData['value'];
29  }
30 
31  unset($categoryData['custom_attributes']);
32 
33  return $categoryData;
34  }
35 }