/** * Get attributes of an attribute set * Skip attributes not needed for Google Content * * @param int $setId * @param bool $escapeJsQuotes * @return array */ public function _getAttributes($setId, $escapeJsQuotes = false) { $attributes = $this->_attributeFactory->create()->getAllowedAttributes($setId); $result = []; foreach ($attributes as $attribute) { /* @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */ $result[$attribute->getAttributeId()] = $escapeJsQuotes ? $this->escapeJsQuote($attribute->getFrontendLabel()) : $attribute->getFrontendLabel(); } return $result; }
/** * Append to attributes array subattribute's models * * @param array $attributes * @return array */ protected function _initGroupAttributes($attributes) { $group = $this->_config->getAttributeGroupsFlat(); foreach ($group as $child => $parent) { if (isset($attributes[$parent]) && !isset($attributes[$parent]['group_attribute_' . $child])) { $attributes[$parent]->addData(['group_attribute_' . $child => $this->_attributeFactory->createAttribute($child)]); } } return $attributes; }