@@ 985-1004 (lines=20) @@ | ||
982 | ); |
|
983 | } |
|
984 | ||
985 | } elseif ( isset( $attribute['options'] ) ) { |
|
986 | // Array based. |
|
987 | if ( is_array( $attribute['options'] ) ) { |
|
988 | $values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', $attribute['options'] ) ); |
|
989 | ||
990 | // Text based, separate by pipe. |
|
991 | } else { |
|
992 | $values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', explode( WC_DELIMITER, $attribute['options'] ) ) ); |
|
993 | } |
|
994 | ||
995 | // Custom attribute - Add attribute to array and set the values. |
|
996 | $attributes[ sanitize_title( $attribute_name ) ] = array( |
|
997 | 'name' => $attribute_name, |
|
998 | 'value' => $values, |
|
999 | 'position' => isset( $attribute['position'] ) ? absint( $attribute['position'] ) : 0, |
|
1000 | 'is_visible' => ( isset( $attribute['visible'] ) && $attribute['visible'] ) ? 1 : 0, |
|
1001 | 'is_variation' => ( isset( $attribute['variation'] ) && $attribute['variation'] ) ? 1 : 0, |
|
1002 | 'is_taxonomy' => false, |
|
1003 | ); |
|
1004 | } |
|
1005 | } |
|
1006 | ||
1007 | uasort( $attributes, 'wc_product_attribute_uasort_comparison' ); |
@@ 1199-1218 (lines=20) @@ | ||
1196 | ); |
|
1197 | } |
|
1198 | ||
1199 | } elseif ( isset( $attribute['options'] ) ) { |
|
1200 | // Array based |
|
1201 | if ( is_array( $attribute['options'] ) ) { |
|
1202 | $values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', $attribute['options'] ) ); |
|
1203 | ||
1204 | // Text based, separate by pipe |
|
1205 | } else { |
|
1206 | $values = implode( ' ' . WC_DELIMITER . ' ', array_map( 'wc_clean', explode( WC_DELIMITER, $attribute['options'] ) ) ); |
|
1207 | } |
|
1208 | ||
1209 | // Custom attribute - Add attribute to array and set the values |
|
1210 | $attributes[ $attribute_slug ] = array( |
|
1211 | 'name' => wc_clean( $attribute['name'] ), |
|
1212 | 'value' => $values, |
|
1213 | 'position' => isset( $attribute['position'] ) ? absint( $attribute['position'] ) : 0, |
|
1214 | 'is_visible' => ( isset( $attribute['visible'] ) && $attribute['visible'] ) ? 1 : 0, |
|
1215 | 'is_variation' => ( isset( $attribute['variation'] ) && $attribute['variation'] ) ? 1 : 0, |
|
1216 | 'is_taxonomy' => $is_taxonomy |
|
1217 | ); |
|
1218 | } |
|
1219 | } |
|
1220 | ||
1221 | uasort( $attributes, 'wc_product_attribute_uasort_comparison' ); |