woocommerce_wpml = $woocommerce_wpml; } public function get_model() { $wc_attributes = wc_get_attribute_taxonomies(); $wc_attributes_translated = $this->woocommerce_wpml->attributes->get_translatable_attributes(); $attribute_names = []; foreach ( $wc_attributes_translated as $attribute ) { $attribute_names[] = $attribute->attribute_name; } $attributes = []; foreach ( $wc_attributes as $attribute ) { $attributes[] = [ 'name' => $attribute->attribute_name, 'label' => $attribute->attribute_label, 'translated' => in_array( $attribute->attribute_name, $attribute_names, true ), ]; } return [ 'strings' => [ 'step_id' => 'attributes_step', 'heading' => __( 'Which product attributes should be translatable?', 'woocommerce-multilingual' ), // @todo: Check UTM tags for wizard. 'description_1' => sprintf( esc_html__( 'WPML allows you to %1$stranslate your product attributes%2$s. Some attributes, like the ones based on numbers and codes, can be universal and might not need to be translated.', 'woocommerce-multilingual' ), '', '' ), 'description_2' => __( 'Select which attributes in your store should be translatable:', 'woocommerce-multilingual' ), 'no_attributes' => __( 'There are no attributes defined', 'woocommerce-multilingual' ), 'continue' => __( 'Continue', 'woocommerce-multilingual' ), 'go_back' => __( 'Go back', 'woocommerce-multilingual' ), ], 'attributes' => $attributes, 'continue_url' => $this->next_step_url, 'go_back_url' => $this->previous_step_url, ]; } public function get_template() { return '/setup/attributes.twig'; } }