| @@ -1,9 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * Cart Reserved Timer Options. | |
| 4 | + * Cart Reserved Timer — 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' ) ) { |
| @@ -9,9 +12,10 @@ | ||
| 9 | 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | 13 | exit; // Exit if accessed directly |
| 11 | 14 | } |
| 12 | 15 | |
| 13 | -Merchant_Admin_Options::create( array( | |
| 16 | +return array( | |
| 17 | + array( | |
| 14 | 18 | 'title' => esc_html__( 'Settings', 'merchant' ), |
| 15 | 19 | 'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 16 | 20 | 'fields' => array( |
| 17 | 21 | array( |
| @@ -24,8 +28,11 @@ | ||
| 24 | 28 | ), |
| 25 | 29 | 'default' => 'sale-dates', |
| 26 | 30 | 'desc' => esc_html__( '"Sale Price Dates" will countdown to a specified end-date and time. "Evergreen" generates a unique expiration date for each visitor and product, within set minimum and maximum deadlines', |
| 27 | 31 | 'merchant' ), |
| 32 | + 'ai_meta' => array( | |
| 33 | + 'usage_hint' => 'Controls the countdown mode. Set BEFORE other fields: sale-dates enables sale_start_date and sale_end_date; evergreen enables cool_off_period and the min/max expiration deadline fields.', | |
| 34 | + ), | |
| 28 | 35 | ), |
| 29 | 36 | |
| 30 | 37 | array( |
| 31 | 38 | 'id' => 'sale_start_date', |
| @@ -32,8 +39,13 @@ | ||
| 32 | 39 | 'type' => 'date_time', |
| 33 | 40 | 'title' => esc_html__( 'Countdown starts at', 'merchant' ), |
| 34 | 41 | 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ), |
| 35 | 42 | 'condition' => array( 'end_date', '==', 'sale-dates' ), |
| 43 | + 'ai_meta' => array( | |
| 44 | + 'allow_empty' => true, | |
| 45 | + 'value_format' => 'm-d-Y h:i A', | |
| 46 | + 'usage_hint' => 'Optional. Countdown start date. Format: m-d-Y h:i A (e.g., 06-24-2026 03:30 PM). Requires end_date=sale-dates.', | |
| 47 | + ), | |
| 36 | 48 | ), |
| 37 | 49 | |
| 38 | 50 | array( |
| 39 | 51 | 'id' => 'sale_end_date', |
| @@ -40,8 +52,13 @@ | ||
| 40 | 52 | 'type' => 'date_time', |
| 41 | 53 | 'title' => esc_html__( 'Countdown ends at', 'merchant' ), |
| 42 | 54 | 'placeholder' => esc_html__( 'mm/dd/yy, --:-- --', 'merchant' ), |
| 43 | 55 | 'condition' => array( 'end_date', '==', 'sale-dates' ), |
| 56 | + 'ai_meta' => array( | |
| 57 | + 'allow_empty' => true, | |
| 58 | + 'value_format' => 'm-d-Y h:i A', | |
| 59 | + 'usage_hint' => 'Optional. Countdown end date. Leave empty for no end. Format: m-d-Y h:i A (e.g., 06-24-2026 03:30 PM). Requires end_date=sale-dates.', | |
| 60 | + ), | |
| 44 | 61 | 'desc' => sprintf( |
| 45 | 62 | /* Translators: %1$s: Time zone, %2$s WordPress setting link */ |
| 46 | 63 | esc_html__( 'The countdown bar will only be displayed during this range. The times set above are in the %1$s timezone, according to your settings from %2$s.', |
| 47 | 64 | 'merchant' ), |
| @@ -146,12 +163,10 @@ | ||
| 146 | 163 | 'class' => 'merchant-countdown-evergreen-field', |
| 147 | 164 | 'condition' => array( 'end_date', '==', 'evergreen' ), |
| 148 | 165 | ), |
| 149 | 166 | ), |
| 150 | -) ); | |
| 151 | - | |
| 152 | -// Display Settings | |
| 153 | -Merchant_Admin_Options::create( array( | |
| 167 | +), | |
| 168 | + array( | |
| 154 | 169 | 'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 155 | 170 | 'title' => esc_html__( 'Display Settings', 'merchant' ), |
| 156 | 171 | 'fields' => array( |
| 157 | 172 | array( |
| @@ -218,11 +233,10 @@ | ||
| 218 | 233 | ), |
| 219 | 234 | 'default' => 'left', |
| 220 | 235 | ), |
| 221 | 236 | ), |
| 222 | -) ); | |
| 223 | - | |
| 224 | -Merchant_Admin_Options::create( array( | |
| 237 | +), | |
| 238 | + array( | |
| 225 | 239 | 'title' => esc_html__( 'Look and Feel', 'merchant' ), |
| 226 | 240 | 'module' => Merchant_Countdown_Timer::MODULE_ID, |
| 227 | 241 | 'fields' => array( |
| 228 | 242 | array( |
| @@ -326,14 +340,11 @@ | ||
| 326 | 340 | 'unit' => 'px', |
| 327 | 341 | 'condition' => array( 'theme', 'any', 'minimalist|cards|modern|squares|circles' ), |
| 328 | 342 | ), |
| 329 | 343 | ), |
| 330 | -) ); | |
| 331 | - | |
| 332 | -// Shortcode | |
| 333 | -$merchant_module_id = Merchant_Countdown_Timer::MODULE_ID; | |
| 334 | -Merchant_Admin_Options::create( array( | |
| 335 | - 'module' => $merchant_module_id, | |
| 344 | +), | |
| 345 | + array( | |
| 346 | + 'module' => Merchant_Countdown_Timer::MODULE_ID, | |
| 336 | 347 | 'title' => esc_html__( 'Use shortcode', 'merchant' ), |
| 337 | 348 | 'fields' => array( |
| 338 | 349 | array( |
| 339 | 350 | 'id' => 'use_shortcode', |
| @@ -349,9 +360,10 @@ | ||
| 349 | 360 | array( |
| 350 | 361 | 'id' => 'shortcode_text', |
| 351 | 362 | 'type' => 'text_readonly', |
| 352 | 363 | 'title' => esc_html__( 'Shortcode text', 'merchant' ), |
| 353 | - 'default' => '[merchant_module_' . str_replace( '-', '_', $merchant_module_id ) . ']', | |
| 364 | + 'default' => '[merchant_module_' . str_replace( '-', '_', Merchant_Countdown_Timer::MODULE_ID ) . ']', | |
| 354 | 365 | 'condition' => array( 'use_shortcode', '==', '1' ), |
| 355 | 366 | ), |
| 356 | 367 | ), |
| 357 | -) ); | |
| 368 | +), | |
| 369 | +); | |