/** * @param AttributeInterface $attribute * @param array $data */ protected function addAvailableLocales(AttributeInterface $attribute, $data) { if (strtolower($data['available_locales']) !== 'all') { $locales = explode(',', $data['available_locales']); foreach ($locales as $localeCode) { $locale = new Locale(); $locale->setCode($localeCode); $attribute->addAvailableLocale($locale); } } }
/** * @param AttributeInterface $attribute * @param array $data */ protected function setAvailableLocales(AttributeInterface $attribute, array $data) { $localeSpecificCodes = $attribute->getLocaleSpecificCodes(); foreach ($data as $localeCode) { if (!in_array($localeCode, $localeSpecificCodes)) { $locale = $this->localeRepository->findOneByIdentifier($localeCode); $attribute->addAvailableLocale($locale); } } }
/** * @param AttributeInterface $attribute * @param array $data */ protected function addAvailableLocales(AttributeInterface $attribute, $data) { foreach ($data['available_locales'] as $code) { $locale = new Locale(); $locale->setCode($code); $attribute->addAvailableLocale($locale); } }