|
@@ -66,46 +66,46 @@ discard block |
|
|
block discarded – undo |
|
66
|
66
|
*/ |
|
67
|
67
|
public function render_block( $attributes, $content ) { |
|
68
|
68
|
|
|
69
|
|
- if ( ! isset( $attributes['form_id'] ) ) { |
|
|
69
|
+ if ( ! isset( $attributes[ 'form_id' ] ) ) { |
|
70
|
70
|
return; |
|
71
|
71
|
} |
|
72
|
72
|
|
|
73
|
73
|
$shortcode_attributes = array( |
|
74
|
|
- 'form' => $attributes['form_id'], |
|
75
|
|
- 'submit' => isset( $attributes['submit_button_text'] ) && ! empty( $attributes['submit_button_text'] ) ? $attributes['submit_button_text'] : '', |
|
76
|
|
- 'title' => isset( $attributes['show_title'] ) && true === $attributes['show_title'] ? '1' : '0', |
|
77
|
|
- 'custom_title' => isset( $attributes['form_title'] ) ? $attributes['form_title'] : '', |
|
78
|
|
- 'description' => isset( $attributes['show_description'] ) && true === $attributes['show_description'] ? '1' : '0', |
|
79
|
|
- 'custom_description' => isset( $attributes['form_description'] ) ? $attributes['form_description'] : '', |
|
80
|
|
- 'ajax' => isset( $attributes['is_ajax'] ) && true === $attributes['is_ajax'] ? '1' : '0', |
|
81
|
|
- 'recaptcha' => ! isset( $attributes['recaptcha'] ) || isset( $attributes['recaptcha'] ) && false === $attributes['recaptcha'] ? '0' : '', |
|
82
|
|
- 'recaptcha_lang' => isset( $attributes['recaptcha_lang'] ) ? $attributes['recaptcha_lang'] : '', |
|
83
|
|
- 'recaptcha_type' => isset( $attributes['recaptcha_type'] ) ? $attributes['recaptcha_type'] : '', |
|
84
|
|
- 'recaptcha_theme' => isset( $attributes['recaptcha_theme'] ) ? $attributes['recaptcha_theme'] : '', |
|
85
|
|
- 'recaptcha_size' => isset( $attributes['recaptcha_size'] ) ? $attributes['recaptcha_size'] : '', |
|
86
|
|
- 'recaptcha_data_callback' => isset( $attributes['recaptcha_verify_callback'] ) ? $attributes['recaptcha_verify_callback'] : '', |
|
87
|
|
- 'recaptcha_expired_callback' => isset( $attributes['recaptcha_expired_callback'] ) ? $attributes['recaptcha_expired_callback'] : '', |
|
88
|
|
- 'inline' => isset( $attributes['inline'] ) && true === $attributes['inline'] ? '1' : '0', |
|
|
74
|
+ 'form' => $attributes[ 'form_id' ], |
|
|
75
|
+ 'submit' => isset( $attributes[ 'submit_button_text' ] ) && ! empty( $attributes[ 'submit_button_text' ] ) ? $attributes[ 'submit_button_text' ] : '', |
|
|
76
|
+ 'title' => isset( $attributes[ 'show_title' ] ) && true === $attributes[ 'show_title' ] ? '1' : '0', |
|
|
77
|
+ 'custom_title' => isset( $attributes[ 'form_title' ] ) ? $attributes[ 'form_title' ] : '', |
|
|
78
|
+ 'description' => isset( $attributes[ 'show_description' ] ) && true === $attributes[ 'show_description' ] ? '1' : '0', |
|
|
79
|
+ 'custom_description' => isset( $attributes[ 'form_description' ] ) ? $attributes[ 'form_description' ] : '', |
|
|
80
|
+ 'ajax' => isset( $attributes[ 'is_ajax' ] ) && true === $attributes[ 'is_ajax' ] ? '1' : '0', |
|
|
81
|
+ 'recaptcha' => ! isset( $attributes[ 'recaptcha' ] ) || isset( $attributes[ 'recaptcha' ] ) && false === $attributes[ 'recaptcha' ] ? '0' : '', |
|
|
82
|
+ 'recaptcha_lang' => isset( $attributes[ 'recaptcha_lang' ] ) ? $attributes[ 'recaptcha_lang' ] : '', |
|
|
83
|
+ 'recaptcha_type' => isset( $attributes[ 'recaptcha_type' ] ) ? $attributes[ 'recaptcha_type' ] : '', |
|
|
84
|
+ 'recaptcha_theme' => isset( $attributes[ 'recaptcha_theme' ] ) ? $attributes[ 'recaptcha_theme' ] : '', |
|
|
85
|
+ 'recaptcha_size' => isset( $attributes[ 'recaptcha_size' ] ) ? $attributes[ 'recaptcha_size' ] : '', |
|
|
86
|
+ 'recaptcha_data_callback' => isset( $attributes[ 'recaptcha_verify_callback' ] ) ? $attributes[ 'recaptcha_verify_callback' ] : '', |
|
|
87
|
+ 'recaptcha_expired_callback' => isset( $attributes[ 'recaptcha_expired_callback' ] ) ? $attributes[ 'recaptcha_expired_callback' ] : '', |
|
|
88
|
+ 'inline' => isset( $attributes[ 'inline' ] ) && true === $attributes[ 'inline' ] ? '1' : '0', |
|
89
|
89
|
); |
|
90
|
90
|
|
|
91
|
91
|
// We want to run process_mailchimp_shortcode() but we need to return the plaintext shortcode or Gutenberg will autop() the shortcode content. |
|
92
|
92
|
return sprintf( |
|
93
|
93
|
'[yikes-mailchimp form="%s" submit="%s" title="%s" custom_title="%s" description="%s" custom_description="%s" ajax="%s" recaptcha="%s" recaptcha_lang="%s" recaptcha_type="%s" recaptcha_theme="%s" recaptcha_size="%s" recaptcha_data_callback="%s" recaptcha_expired_callback="%s" inline="%s"]', |
|
94
|
|
- $shortcode_attributes['form'], |
|
95
|
|
- $shortcode_attributes['submit'], |
|
96
|
|
- $shortcode_attributes['title'], |
|
97
|
|
- $shortcode_attributes['custom_title'], |
|
98
|
|
- $shortcode_attributes['description'], |
|
99
|
|
- $shortcode_attributes['custom_description'], |
|
100
|
|
- $shortcode_attributes['ajax'], |
|
101
|
|
- $shortcode_attributes['recaptcha'], |
|
102
|
|
- $shortcode_attributes['recaptcha_lang'], |
|
103
|
|
- $shortcode_attributes['recaptcha_type'], |
|
104
|
|
- $shortcode_attributes['recaptcha_theme'], |
|
105
|
|
- $shortcode_attributes['recaptcha_size'], |
|
106
|
|
- $shortcode_attributes['recaptcha_data_callback'], |
|
107
|
|
- $shortcode_attributes['recaptcha_expired_callback'], |
|
108
|
|
- $shortcode_attributes['inline'] |
|
|
94
|
+ $shortcode_attributes[ 'form' ], |
|
|
95
|
+ $shortcode_attributes[ 'submit' ], |
|
|
96
|
+ $shortcode_attributes[ 'title' ], |
|
|
97
|
+ $shortcode_attributes[ 'custom_title' ], |
|
|
98
|
+ $shortcode_attributes[ 'description' ], |
|
|
99
|
+ $shortcode_attributes[ 'custom_description' ], |
|
|
100
|
+ $shortcode_attributes[ 'ajax' ], |
|
|
101
|
+ $shortcode_attributes[ 'recaptcha' ], |
|
|
102
|
+ $shortcode_attributes[ 'recaptcha_lang' ], |
|
|
103
|
+ $shortcode_attributes[ 'recaptcha_type' ], |
|
|
104
|
+ $shortcode_attributes[ 'recaptcha_theme' ], |
|
|
105
|
+ $shortcode_attributes[ 'recaptcha_size' ], |
|
|
106
|
+ $shortcode_attributes[ 'recaptcha_data_callback' ], |
|
|
107
|
+ $shortcode_attributes[ 'recaptcha_expired_callback' ], |
|
|
108
|
+ $shortcode_attributes[ 'inline' ] |
|
109
|
109
|
); |
|
110
|
110
|
} |
|
111
|
111
|
} |
|
@@ -121,4 +121,4 @@ discard block |
|
|
block discarded – undo |
|
121
|
121
|
) |
|
122
|
122
|
); |
|
123
|
123
|
} |
|
124
|
|
-add_filter( 'block_categories', 'easy_form_category', 10, 2); |
|
|
124
|
+add_filter( 'block_categories', 'easy_form_category', 10, 2 ); |