Onboarding.php
5 months ago
OnboardingHelper.php
1 year ago
OnboardingIndustries.php
2 years ago
OnboardingJetpack.php
3 years ago
OnboardingMailchimp.php
3 years ago
OnboardingProducts.php
3 years ago
OnboardingProfile.php
1 year ago
OnboardingSetupWizard.php
1 year ago
OnboardingSync.php
2 years ago
OnboardingIndustries.php
94 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WooCommerce Onboarding Industries |
| 4 | */ |
| 5 | |
| 6 | namespace Automattic\WooCommerce\Internal\Admin\Onboarding; |
| 7 | |
| 8 | /** |
| 9 | * Logic around onboarding industries. |
| 10 | */ |
| 11 | class OnboardingIndustries { |
| 12 | /** |
| 13 | * Init. |
| 14 | */ |
| 15 | public static function init() { |
| 16 | add_filter( 'woocommerce_admin_onboarding_preloaded_data', array( __CLASS__, 'preload_data' ) ); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Get a list of allowed industries for the onboarding wizard. |
| 21 | * |
| 22 | * @return array |
| 23 | */ |
| 24 | public static function get_allowed_industries() { |
| 25 | /* With "use_description" we turn the description input on. With "description_label" we set the input label */ |
| 26 | return apply_filters( |
| 27 | 'woocommerce_admin_onboarding_industries', |
| 28 | array( |
| 29 | 'fashion-apparel-accessories' => array( |
| 30 | 'label' => __( 'Fashion, apparel, and accessories', 'woocommerce' ), |
| 31 | 'use_description' => false, |
| 32 | 'description_label' => '', |
| 33 | ), |
| 34 | 'health-beauty' => array( |
| 35 | 'label' => __( 'Health and beauty', 'woocommerce' ), |
| 36 | 'use_description' => false, |
| 37 | 'description_label' => '', |
| 38 | ), |
| 39 | 'electronics-computers' => array( |
| 40 | 'label' => __( 'Electronics and computers', 'woocommerce' ), |
| 41 | 'use_description' => false, |
| 42 | 'description_label' => '', |
| 43 | ), |
| 44 | 'food-drink' => array( |
| 45 | 'label' => __( 'Food and drink', 'woocommerce' ), |
| 46 | 'use_description' => false, |
| 47 | 'description_label' => '', |
| 48 | ), |
| 49 | 'home-furniture-garden' => array( |
| 50 | 'label' => __( 'Home, furniture, and garden', 'woocommerce' ), |
| 51 | 'use_description' => false, |
| 52 | 'description_label' => '', |
| 53 | ), |
| 54 | 'cbd-other-hemp-derived-products' => array( |
| 55 | 'label' => __( 'CBD and other hemp-derived products', 'woocommerce' ), |
| 56 | 'use_description' => false, |
| 57 | 'description_label' => '', |
| 58 | ), |
| 59 | 'education-and-learning' => array( |
| 60 | 'label' => __( 'Education and learning', 'woocommerce' ), |
| 61 | 'use_description' => false, |
| 62 | 'description_label' => '', |
| 63 | ), |
| 64 | 'sports-and-recreation' => array( |
| 65 | 'label' => __( 'Sports and recreation', 'woocommerce' ), |
| 66 | 'use_description' => false, |
| 67 | 'description_label' => '', |
| 68 | ), |
| 69 | 'arts-and-crafts' => array( |
| 70 | 'label' => __( 'Arts and crafts', 'woocommerce' ), |
| 71 | 'use_description' => false, |
| 72 | 'description_label' => '', |
| 73 | ), |
| 74 | 'other' => array( |
| 75 | 'label' => __( 'Other', 'woocommerce' ), |
| 76 | 'use_description' => true, |
| 77 | 'description_label' => __( 'Description', 'woocommerce' ), |
| 78 | ), |
| 79 | ) |
| 80 | ); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Add preloaded data to onboarding. |
| 85 | * |
| 86 | * @param array $settings Component settings. |
| 87 | * @return array |
| 88 | */ |
| 89 | public static function preload_data( $settings ) { |
| 90 | $settings['onboarding']['industries'] = self::get_allowed_industries(); |
| 91 | return $settings; |
| 92 | } |
| 93 | } |
| 94 |