/** * * @param class $setup * @param array $config * @return bool */ public function deleteAttributesFromCategory($setup, $config) { //put suffixes in single array for in_array check $config_suffixes = array(); foreach ($config as $config_row) { $config_suffixes[] = $config_row['attrcode_suffix']; } //delete old attributes foreach ($this->getAttributeCodes() as $attrcode) { $attrcode_suffix = substr($attrcode, 13); //convert loe_seo_text_demo to demo if (preg_match("/^" . self::LOEWENSTARK_SEO_TEXT_CATEGORY_ATTRIBUTES_PREFIX . "/", $attrcode) && !in_array($attrcode_suffix, $config_suffixes)) { $setup->removeAttribute('catalog_category', $attrcode); } } }