| @@ -1,9 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * Wait List Options. | |
| 4 | + * Wait List — Option group definitions. | |
| 5 | 5 | * |
| 6 | + * Pure data file. Returns the option groups array | |
| 7 | + * consumed by init_option_groups(). | |
| 8 | + * | |
| 6 | 9 | * @package Merchant |
| 7 | 10 | */ |
| 8 | 11 | |
| 9 | 12 | if ( ! defined( 'ABSPATH' ) ) { |
| @@ -10,9 +13,11 @@ | ||
| 10 | 13 | exit; // Exit if accessed directly |
| 11 | 14 | } |
| 12 | 15 | |
| 13 | 16 | // Form Settings |
| 14 | -Merchant_Admin_Options::create( array( | |
| 17 | + | |
| 18 | +return array( | |
| 19 | + array( | |
| 15 | 20 | 'title' => esc_html__( 'Form Settings', 'merchant' ), |
| 16 | 21 | 'module' => Merchant_Wait_List::MODULE_ID, |
| 17 | 22 | 'fields' => array( |
| 18 | 23 | |
| @@ -63,13 +68,18 @@ | ||
| 63 | 68 | 'title' => esc_html__( 'Exclude products', 'merchant' ), |
| 64 | 69 | 'multiple' => true, |
| 65 | 70 | 'desc' => esc_html__( 'Select any products that will be excluded from the waitlist.', 'merchant' ), |
| 66 | 71 | 'allowed_types' => array( 'simple', 'variable' ), |
| 72 | + 'ai_meta' => array( | |
| 73 | + 'entity' => 'product', | |
| 74 | + 'reference_type' => 'static', | |
| 75 | + 'value_format' => 'product_id', | |
| 76 | + 'usage_hint' => 'Specific products to exclude from the waitlist globally. Static: only the selected products are excluded. For module-wide exclusion of simple and variable products by ID.', | |
| 77 | + ), | |
| 67 | 78 | ), |
| 68 | 79 | ), |
| 69 | -) ); | |
| 70 | - | |
| 71 | -Merchant_Admin_Options::create( array( | |
| 80 | +), | |
| 81 | + array( | |
| 72 | 82 | 'title' => esc_html__( 'Email Settings', 'merchant' ), |
| 73 | 83 | 'module' => Merchant_Wait_List::MODULE_ID, |
| 74 | 84 | 'fields' => array( |
| 75 | 85 | |
| @@ -81,8 +91,16 @@ | ||
| 81 | 91 | 'desc' => esc_html__( 'When products are back in stock, send emails automatically to subscribers to let them know.', 'merchant' ), |
| 82 | 92 | ), |
| 83 | 93 | |
| 84 | 94 | array( |
| 95 | + 'id' => 'show_notified_users', | |
| 96 | + 'type' => 'switcher', | |
| 97 | + 'title' => __( 'Show notified users', 'merchant' ), | |
| 98 | + 'default' => 1, | |
| 99 | + 'desc' => esc_html__( 'When products are back in stock, show an admin notice with a list of the notified users', 'merchant' ), | |
| 100 | + ), | |
| 101 | + | |
| 102 | + array( | |
| 85 | 103 | 'id' => 'email_new_subscriber', |
| 86 | 104 | 'type' => 'textarea_multiline', |
| 87 | 105 | 'title' => esc_html__( 'Email new subscribers', 'merchant' ), |
| 88 | 106 | 'default' => __( 'Hello, thank you for joining the stock notification list for {product}. We will email you when the product is back in stock.', 'merchant' ), |
| @@ -132,14 +150,11 @@ | ||
| 132 | 150 | ) |
| 133 | 151 | ), |
| 134 | 152 | ), |
| 135 | 153 | ), |
| 136 | -) ); | |
| 137 | - | |
| 138 | -// Shortcode | |
| 139 | -$merchant_module_id = Merchant_Wait_List::MODULE_ID; | |
| 140 | -Merchant_Admin_Options::create( array( | |
| 141 | - 'module' => $merchant_module_id, | |
| 154 | +), | |
| 155 | + array( | |
| 156 | + 'module' => Merchant_Wait_List::MODULE_ID, | |
| 142 | 157 | 'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 143 | 158 | 'fields' => array( |
| 144 | 159 | array( |
| 145 | 160 | 'id' => 'use_shortcode', |
| @@ -155,9 +170,10 @@ | ||
| 155 | 170 | array( |
| 156 | 171 | 'id' => 'shortcode_text', |
| 157 | 172 | 'type' => 'text_readonly', |
| 158 | 173 | 'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 159 | - 'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', | |
| 174 | + 'default' => '[merchant_module_' . str_replace( '-', '_', Merchant_Wait_List::MODULE_ID ) . ']', | |
| 160 | 175 | 'condition' => array( 'use_shortcode', '==', '1' ), |
| 161 | 176 | ), |
| 162 | 177 | ), |
| 163 | -) ); | |
| 178 | +), | |
| 179 | +); | |