[ label, default ]. */ public static function color_fields() { return array( 'color_bg' => array( 'label' => __( 'Background', 'ab-veh-take' ), 'default' => '#0b1130' ), 'color_panel' => array( 'label' => __( 'Panel Background', 'ab-veh-take' ), 'default' => '#101a3e' ), 'color_panel_2' => array( 'label' => __( 'Input Background', 'ab-veh-take' ), 'default' => '#16214f' ), 'color_border' => array( 'label' => __( 'Border', 'ab-veh-take' ), 'default' => '#263569' ), 'color_text' => array( 'label' => __( 'Text', 'ab-veh-take' ), 'default' => '#eef2fb' ), 'color_text_muted' => array( 'label' => __( 'Muted Text', 'ab-veh-take' ), 'default' => '#90a0cf' ), 'color_accent' => array( 'label' => __( 'Accent (Blue)', 'ab-veh-take' ), 'default' => '#4647AE' ), 'color_accent_light'=> array( 'label' => __( 'Accent Light', 'ab-veh-take' ), 'default' => '#4382DF' ), 'color_accent_dark' => array( 'label' => __( 'Accent Dark', 'ab-veh-take' ), 'default' => '#112E81' ), 'color_icon' => array( 'label' => __( 'Icon Color', 'ab-veh-take' ), 'default' => '#4382DF' ), 'color_success' => array( 'label' => __( 'Wide Availability', 'ab-veh-take' ), 'default' => '#43cd8e' ), 'color_warning' => array( 'label' => __( 'Limited Availability', 'ab-veh-take' ), 'default' => '#e7a83e' ), 'color_danger' => array( 'label' => __( 'Very Limited Availability', 'ab-veh-take' ), 'default' => '#e35c62' ), 'color_disabled' => array( 'label' => __( 'Unavailable', 'ab-veh-take' ), 'default' => '#3a4570' ), 'color_button_text' => array( 'label' => __( 'Button Text', 'ab-veh-take' ), 'default' => '#f5f8ff' ), ); } /** * Editable plain-text labels shown on the form (availability legend). */ public static function text_fields() { return array( 'label_wide' => array( 'label' => __( '"Wide availability" legend text', 'ab-veh-take' ), 'default' => __( 'Wide availability', 'ab-veh-take' ) ), 'label_limited' => array( 'label' => __( '"Limited" legend text', 'ab-veh-take' ), 'default' => __( 'Limited', 'ab-veh-take' ) ), 'label_scarce' => array( 'label' => __( '"Very limited" legend text', 'ab-veh-take' ), 'default' => __( 'Very limited', 'ab-veh-take' ) ), 'label_unavailable' => array( 'label' => __( '"Unavailable" legend text', 'ab-veh-take' ), 'default' => __( 'Unavailable', 'ab-veh-take' ) ), ); } /** * Editable copy used throughout the public booking form. */ public static function content_fields() { return array( 'tab_oneway' => array( 'label' => __( 'One-way tab text', 'ab-veh-take' ), 'default' => __( 'One-Way Journey', 'ab-veh-take' ) ), 'tab_multistop' => array( 'label' => __( 'Multi-stop tab text', 'ab-veh-take' ), 'default' => __( 'Multi-Stop Journey', 'ab-veh-take' ) ), 'section_journey' => array( 'label' => __( 'Journey section heading', 'ab-veh-take' ), 'default' => __( 'Journey Details', 'ab-veh-take' ) ), 'pickup_label' => array( 'label' => __( 'Pickup field label', 'ab-veh-take' ), 'default' => __( 'Pickup Address', 'ab-veh-take' ) ), 'pickup_placeholder' => array( 'label' => __( 'Pickup field placeholder', 'ab-veh-take' ), 'default' => __( 'Enter pickup address', 'ab-veh-take' ) ), 'destination_label' => array( 'label' => __( 'Destination field label', 'ab-veh-take' ), 'default' => __( 'Destination Address', 'ab-veh-take' ) ), 'destination_placeholder' => array( 'label' => __( 'Destination field placeholder', 'ab-veh-take' ), 'default' => __( 'Enter destination address', 'ab-veh-take' ) ), 'add_stop' => array( 'label' => __( 'Add-stop button text', 'ab-veh-take' ), 'default' => __( 'Add Another Stop', 'ab-veh-take' ) ), 'stop_placeholder' => array( 'label' => __( 'Intermediate stop placeholder', 'ab-veh-take' ), 'default' => __( 'Enter stop address', 'ab-veh-take' ) ), 'final_stop_placeholder' => array( 'label' => __( 'Final destination placeholder', 'ab-veh-take' ), 'default' => __( 'Enter final destination', 'ab-veh-take' ) ), 'wait_label' => array( 'label' => __( 'Stop wait-time label', 'ab-veh-take' ), 'default' => __( 'Wait time here', 'ab-veh-take' ) ), 'minutes_label' => array( 'label' => __( 'Minutes suffix', 'ab-veh-take' ), 'default' => __( 'mins', 'ab-veh-take' ) ), 'section_datetime' => array( 'label' => __( 'Date and time section heading', 'ab-veh-take' ), 'default' => __( 'Select Date & Time', 'ab-veh-take' ) ), 'time_label' => array( 'label' => __( 'Pickup time label', 'ab-veh-take' ), 'default' => __( 'Pickup Time', 'ab-veh-take' ) ), 'section_details' => array( 'label' => __( 'Customer details section heading', 'ab-veh-take' ), 'default' => __( 'Your Details', 'ab-veh-take' ) ), 'name_label' => array( 'label' => __( 'Name field label', 'ab-veh-take' ), 'default' => __( 'Full Name', 'ab-veh-take' ) ), 'name_placeholder' => array( 'label' => __( 'Name field placeholder', 'ab-veh-take' ), 'default' => __( 'Full name', 'ab-veh-take' ) ), 'email_label' => array( 'label' => __( 'Email field label', 'ab-veh-take' ), 'default' => __( 'Email Address', 'ab-veh-take' ) ), 'email_placeholder' => array( 'label' => __( 'Email field placeholder', 'ab-veh-take' ), 'default' => __( 'Email address', 'ab-veh-take' ) ), 'phone_label' => array( 'label' => __( 'Phone field label', 'ab-veh-take' ), 'default' => __( 'Phone Number', 'ab-veh-take' ) ), 'phone_placeholder' => array( 'label' => __( 'Phone field placeholder', 'ab-veh-take' ), 'default' => __( 'e.g. 06 12 34 56 78', 'ab-veh-take' ) ), 'passengers_label' => array( 'label' => __( 'Passengers field label', 'ab-veh-take' ), 'default' => __( 'Number of People', 'ab-veh-take' ) ), 'passengers_placeholder' => array( 'label' => __( 'Passengers field placeholder', 'ab-veh-take' ), 'default' => __( 'e.g. 2', 'ab-veh-take' ) ), 'vehicle_label' => array( 'label' => __( 'Vehicle field label', 'ab-veh-take' ), 'default' => __( 'Vehicle Type', 'ab-veh-take' ) ), 'vehicle_placeholder' => array( 'label' => __( 'Vehicle select placeholder', 'ab-veh-take' ), 'default' => __( 'Select vehicle', 'ab-veh-take' ) ), 'submit_button' => array( 'label' => __( 'Submit button text', 'ab-veh-take' ), 'default' => __( 'Request Instant Quote', 'ab-veh-take' ) ), 'modal_title' => array( 'label' => __( 'Success dialog heading', 'ab-veh-take' ), 'default' => __( 'Request Submitted', 'ab-veh-take' ) ), 'modal_text' => array( 'label' => __( 'Success dialog text', 'ab-veh-take' ), 'default' => __( 'Your journey request has been received.', 'ab-veh-take' ) ), 'modal_close' => array( 'label' => __( 'Success dialog close text', 'ab-veh-take' ), 'default' => __( 'Close', 'ab-veh-take' ) ), 'no_date_text' => array( 'label' => __( 'No-date summary text', 'ab-veh-take' ), 'default' => __( 'No date selected yet', 'ab-veh-take' ) ), 'selected_prefix' => array( 'label' => __( 'Selected-date prefix', 'ab-veh-take' ), 'default' => __( 'Selected:', 'ab-veh-take' ) ), 'date_required_message' => array( 'label' => __( 'Missing-date message', 'ab-veh-take' ), 'default' => __( 'Please select a date before requesting a quote.', 'ab-veh-take' ) ), 'sending_text' => array( 'label' => __( 'Sending button text', 'ab-veh-take' ), 'default' => __( 'Sending...', 'ab-veh-take' ) ), 'network_error_message' => array( 'label' => __( 'Network error message', 'ab-veh-take' ), 'default' => __( 'Network error. Please try again.', 'ab-veh-take' ) ), 'journey_required_message'=> array( 'label' => __( 'Missing-journey-details message', 'ab-veh-take' ), 'default' => __( 'Please fill in your journey details before continuing.', 'ab-veh-take' ) ), 'next_button' => array( 'label' => __( 'Step "Next" button text', 'ab-veh-take' ), 'default' => __( 'Continue', 'ab-veh-take' ) ), 'back_button' => array( 'label' => __( 'Step "Back" button text', 'ab-veh-take' ), 'default' => __( 'Back', 'ab-veh-take' ) ), ); } /** * Default list of selectable vehicle types shown on the front-end form. */ public static function default_vehicle_types() { return array( __( 'Van', 'ab-veh-take' ), __( 'Berline', 'ab-veh-take' ) ); } /** * Editable layout / sizing options with individual descriptions. */ public static function layout_fields() { return array( 'form_max_width' => array( 'label' => __( 'Form Max Width (px)', 'ab-veh-take' ), 'default' => '480', 'min' => 320, 'max' => 1200, 'description' => __( 'Controls maximum container width of the booking form. Default 480px.', 'ab-veh-take' ), ), 'card_padding' => array( 'label' => __( 'Card Padding (px)', 'ab-veh-take' ), 'default' => '26', 'min' => 10, 'max' => 48, 'description' => __( 'Internal padding inside each card step. Default 26px.', 'ab-veh-take' ), ), 'field_gap' => array( 'label' => __( 'Field Spacing (px)', 'ab-veh-take' ), 'default' => '16', 'min' => 4, 'max' => 32, 'description' => __( 'Vertical spacing between form fields. Default 16px.', 'ab-veh-take' ), ), 'input_font_size' => array( 'label' => __( 'Input Font Size (px)', 'ab-veh-take' ), 'default' => '14', 'min' => 11, 'max' => 22, 'description' => __( 'Font size for text inputs and dropdowns. Default 14px.', 'ab-veh-take' ), ), 'border_radius' => array( 'label' => __( 'Border Radius (px)', 'ab-veh-take' ), 'default' => '14', 'min' => 0, 'max' => 24, 'description' => __( 'Corner rounding for cards, inputs, and buttons. Default 14px.', 'ab-veh-take' ), ), ); } /** * Typography controls shared by the Settings page and Elementor widget. */ public static function typography_fields() { return array( 'font_family' => array( 'label' => __( 'Font Family', 'ab-veh-take' ), 'default' => 'Manrope' ), 'font_size' => array( 'label' => __( 'Base Font Size (px)', 'ab-veh-take' ), 'default' => '14', 'min' => 10, 'max' => 24 ), 'font_weight' => array( 'label' => __( 'Base Font Weight', 'ab-veh-take' ), 'default' => '400' ), 'heading_size' => array( 'label' => __( 'Heading Size (px)', 'ab-veh-take' ), 'default' => '18', 'min' => 12, 'max' => 36 ), 'heading_weight' => array( 'label' => __( 'Heading Weight', 'ab-veh-take' ), 'default' => '700' ), 'label_size' => array( 'label' => __( 'Field Label Size (px)', 'ab-veh-take' ), 'default' => '10.5', 'min' => 8, 'max' => 18 ), 'label_weight' => array( 'label' => __( 'Field Label Weight', 'ab-veh-take' ), 'default' => '700' ), 'button_size' => array( 'label' => __( 'Button Text Size (px)', 'ab-veh-take' ), 'default' => '12.5', 'min' => 9, 'max' => 22 ), 'button_weight' => array( 'label' => __( 'Button Text Weight', 'ab-veh-take' ), 'default' => '800' ), 'letter_spacing' => array( 'label' => __( 'Letter Spacing (px)', 'ab-veh-take' ), 'default' => '0', 'min' => -2, 'max' => 5, 'step' => 0.1 ), 'heading_spacing' => array( 'label' => __( 'Heading Letter Spacing (px)', 'ab-veh-take' ), 'default' => '1.5', 'min' => 0, 'max' => 6, 'step' => 0.1 ), 'line_height' => array( 'label' => __( 'Line Height', 'ab-veh-take' ), 'default' => '1.5', 'min' => 1, 'max' => 2.5, 'step' => 0.1 ), ); } public static function defaults() { $defaults = array( 'notification_email' => get_option( 'admin_email' ), 'vehicle_types' => self::default_vehicle_types(), ); foreach ( self::color_fields() as $key => $field ) { $defaults[ $key ] = $field['default']; } foreach ( self::text_fields() as $key => $field ) { $defaults[ $key ] = $field['default']; } foreach ( self::content_fields() as $key => $field ) { $defaults[ $key ] = $field['default']; } foreach ( self::layout_fields() as $key => $field ) { $defaults[ $key ] = $field['default']; } foreach ( self::typography_fields() as $key => $field ) { $defaults[ $key ] = $field['default']; } return $defaults; } public static function maybe_set_defaults() { if ( false === get_option( self::OPTION_KEY ) ) { update_option( self::OPTION_KEY, self::defaults() ); } } public static function get_all() { $saved = get_option( self::OPTION_KEY ); return wp_parse_args( (array) $saved, self::defaults() ); } public static function get( $key ) { $all = self::get_all(); return isset( $all[ $key ] ) ? $all[ $key ] : null; } public static function get_vehicle_types() { $types = self::get( 'vehicle_types' ); if ( ! is_array( $types ) ) { $types = self::default_vehicle_types(); } $types = array_values( array_unique( array_filter( array_map( 'trim', $types ) ) ) ); return ! empty( $types ) ? $types : self::default_vehicle_types(); } public static function get_notification_email() { $email = self::get( 'notification_email' ); return ! empty( $email ) ? $email : get_option( 'admin_email' ); } public static function update( $data ) { $current = self::get_all(); $merged = wp_parse_args( $data, $current ); update_option( self::OPTION_KEY, $merged ); } public static function reset_colors() { $current = self::get_all(); foreach ( self::color_fields() as $key => $field ) { $current[ $key ] = $field['default']; } update_option( self::OPTION_KEY, $current ); } public static function reset_layout() { $current = self::get_all(); foreach ( self::layout_fields() as $key => $field ) { $current[ $key ] = $field['default']; } foreach ( self::typography_fields() as $key => $field ) { $current[ $key ] = $field['default']; } update_option( self::OPTION_KEY, $current ); } public static function maybe_migrate_theme_v2() { if ( get_option( 'abvt_theme_v2_migrated' ) ) { return; } $saved = self::get_all(); $changed = false; if ( isset( $saved['color_accent'] ) && '#d7a851' === $saved['color_accent'] ) { foreach ( self::color_fields() as $key => $field ) { $saved[ $key ] = $field['default']; } $changed = true; } if ( isset( $saved['border_radius'] ) && '0' === (string) $saved['border_radius'] ) { foreach ( self::layout_fields() as $key => $field ) { $saved[ $key ] = $field['default']; } $changed = true; } if ( $changed ) { update_option( self::OPTION_KEY, $saved ); } update_option( 'abvt_theme_v2_migrated', 1 ); } }