| @@ -136,25 +136,29 @@ | ||
| 136 | 136 | 'formStyling' => [ |
| 137 | 137 | 'type' => 'object', |
| 138 | 138 | 'description' => __( 'Form styling settings including colors and spacing.', 'sureforms' ), |
| 139 | 139 | 'properties' => [ |
| 140 | - 'primaryColor' => [ | |
| 140 | + 'primaryColor' => [ | |
| 141 | 141 | 'type' => 'string', |
| 142 | 142 | 'description' => __( 'Primary/accent color as hex (e.g. #111C44).', 'sureforms' ), |
| 143 | 143 | ], |
| 144 | - 'textColor' => [ | |
| 144 | + 'textColor' => [ | |
| 145 | 145 | 'type' => 'string', |
| 146 | 146 | 'description' => __( 'Text color as hex (e.g. #1E1E1E).', 'sureforms' ), |
| 147 | 147 | ], |
| 148 | - 'textColorOnPrimary' => [ | |
| 148 | + 'textColorOnPrimary' => [ | |
| 149 | 149 | 'type' => 'string', |
| 150 | 150 | 'description' => __( 'Text color on primary backgrounds as hex (e.g. #FFFFFF).', 'sureforms' ), |
| 151 | 151 | ], |
| 152 | - 'fieldSpacing' => [ | |
| 152 | + 'fieldSpacing' => [ | |
| 153 | 153 | 'type' => 'string', |
| 154 | 154 | 'description' => __( 'Spacing between fields.', 'sureforms' ), |
| 155 | 155 | 'enum' => [ 'small', 'medium', 'large' ], |
| 156 | 156 | ], |
| 157 | + 'disableDefaultStyles' => [ | |
| 158 | + 'type' => 'boolean', | |
| 159 | + 'description' => __( 'When true, SureForms does not enqueue its default frontend styles for this form, so the active theme styling applies instead.', 'sureforms' ), | |
| 160 | + ], | |
| 157 | 161 | ], |
| 158 | 162 | ], |
| 159 | 163 | 'emailNotification' => [ |
| 160 | 164 | 'type' => 'object', |
| @@ -330,9 +334,16 @@ | ||
| 330 | 334 | |
| 331 | 335 | // Get default post meta. |
| 332 | 336 | $post_metas = Create_New_Form::get_default_meta_keys(); |
| 333 | 337 | |
| 334 | - // Add serialized meta defaults for metadata overrides. | |
| 338 | + // Pull complex-meta defaults from the registered schemas so created | |
| 339 | + // forms are identical to hand-created ones. Storing empty arrays/strings | |
| 340 | + // would override the register_post_meta 'default' values (WordPress only | |
| 341 | + // uses those defaults when no value is stored at all), causing confirmation | |
| 342 | + // messages, email notifications, styling, and restriction settings to be | |
| 343 | + // blank for any form created through this code path. | |
| 344 | + $registered = get_registered_meta_keys( 'post', SRFM_FORMS_POST_TYPE ); | |
| 345 | + | |
| 335 | 346 | $post_metas['_srfm_instant_form_settings'] = [ |
| 336 | 347 | 'bg_type' => 'color', |
| 337 | 348 | 'bg_color' => '#ffffff', |
| 338 | 349 | 'bg_image' => '', |
| @@ -344,13 +355,13 @@ | ||
| 344 | 355 | 'form_container_width' => 620, |
| 345 | 356 | 'single_page_form_title' => true, |
| 346 | 357 | 'use_banner_as_page_background' => false, |
| 347 | 358 | ]; |
| 348 | - $post_metas['_srfm_form_confirmation'] = []; | |
| 349 | - $post_metas['_srfm_compliance'] = []; | |
| 350 | - $post_metas['_srfm_forms_styling'] = []; | |
| 351 | - $post_metas['_srfm_email_notification'] = []; | |
| 352 | - $post_metas['_srfm_form_restriction'] = ''; | |
| 359 | + $post_metas['_srfm_form_confirmation'] = $registered['_srfm_form_confirmation']['default'] ?? []; | |
| 360 | + $post_metas['_srfm_compliance'] = $registered['_srfm_compliance']['default'] ?? []; | |
| 361 | + $post_metas['_srfm_forms_styling'] = $registered['_srfm_forms_styling']['default'] ?? []; | |
| 362 | + $post_metas['_srfm_email_notification'] = $registered['_srfm_email_notification']['default'] ?? []; | |
| 363 | + $post_metas['_srfm_form_restriction'] = $registered['_srfm_form_restriction']['default'] ?? ''; | |
| 353 | 364 | $post_metas['_srfm_form_custom_css'] = ''; |
| 354 | 365 | |
| 355 | 366 | // Apply metadata overrides from input. |
| 356 | 367 | $post_metas = $this->apply_metadata_overrides( $post_metas, $meta_data ); |