| @@ -10,8 +10,9 @@ | ||
| 10 | 10 | class FrmFieldCreditCard extends FrmFieldType { |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @var string |
| 14 | + * | |
| 14 | 15 | * @since 3.0 |
| 15 | 16 | */ |
| 16 | 17 | protected $type = 'credit_card'; |
| 17 | 18 | |
| @@ -16,20 +17,23 @@ | ||
| 16 | 17 | protected $type = 'credit_card'; |
| 17 | 18 | |
| 18 | 19 | /** |
| 19 | 20 | * @var bool |
| 21 | + * | |
| 20 | 22 | * @since 3.0 |
| 21 | 23 | */ |
| 22 | 24 | protected $has_for_label = false; |
| 23 | 25 | |
| 26 | + /** | |
| 27 | + * @return array | |
| 28 | + */ | |
| 24 | 29 | protected function field_settings_for_type() { |
| 25 | - $settings = array( | |
| 30 | + return array( | |
| 26 | 31 | 'clear_on_focus' => false, |
| 27 | 32 | 'description' => false, |
| 28 | 33 | 'default' => false, |
| 29 | 34 | 'required' => false, |
| 30 | 35 | ); |
| 31 | - return $settings; | |
| 32 | 36 | } |
| 33 | 37 | |
| 34 | 38 | protected function include_form_builder_file() { |
| 35 | 39 | return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-credit-card.php'; |
| @@ -37,8 +41,9 @@ | ||
| 37 | 41 | |
| 38 | 42 | /** |
| 39 | 43 | * @param array $args |
| 40 | 44 | * @param array $shortcode_atts |
| 45 | + * | |
| 41 | 46 | * @return string |
| 42 | 47 | */ |
| 43 | 48 | public function front_field_input( $args, $shortcode_atts ) { |
| 44 | 49 | $pass_args = array( |
| @@ -48,11 +53,10 @@ | ||
| 48 | 53 | ); |
| 49 | 54 | |
| 50 | 55 | ob_start(); |
| 51 | 56 | |
| 52 | - if ( FrmAppHelper::is_style_editor_page() ) { | |
| 53 | - // The styler preview doesn't load the Stripe scripts. | |
| 54 | - // We need to use the form builder view instead. | |
| 57 | + if ( FrmAppHelper::is_style_editor_page() || FrmFormsHelper::is_block_or_page_builder_preview() ) { | |
| 58 | + // Payment gateway scripts are unavailable in preview contexts, use the builder placeholder. | |
| 55 | 59 | $field = $this->field; |
| 56 | 60 | include $this->include_form_builder_file(); |
| 57 | 61 | } else { |
| 58 | 62 | FrmStrpLiteActionsController::show_card( $this->field, $args['field_name'], $pass_args ); |
| @@ -57,10 +61,7 @@ | ||
| 57 | 61 | } else { |
| 58 | 62 | FrmStrpLiteActionsController::show_card( $this->field, $args['field_name'], $pass_args ); |
| 59 | 63 | } |
| 60 | 64 | |
| 61 | - $input_html = ob_get_contents(); | |
| 62 | - ob_end_clean(); | |
| 63 | - | |
| 64 | - return $input_html; | |
| 65 | + return ob_get_clean(); | |
| 65 | 66 | } |
| 66 | 67 | } |