Skip to content

Commit 0159c7e

Browse files
committed
Move required indicator to the bottom of the form
1 parent 12c21f4 commit 0159c7e

File tree

4 files changed

+29
-19
lines changed

4 files changed

+29
-19
lines changed

includes/blocks/mailchimp/edit.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ export const BlockEdit = (props) => {
255255
<RichText
256256
className="mailchimp-block__sub-header"
257257
tagName="h3"
258-
placeholder={__('Enter a sub header (optional)', 'mailchimp')}
258+
placeholder={__(
259+
'Enter a sub header (optional)',
260+
'mailchimp',
261+
)}
259262
value={sub_header}
260263
onChange={(sub_header) => setAttributes({ sub_header })}
261264
/>
@@ -276,17 +279,17 @@ export const BlockEdit = (props) => {
276279
template={template}
277280
templateLock="insert"
278281
/>
279-
{show_required_indicator && (
280-
<div id="mc-indicates-required">
281-
{__('* = required field', 'mailchimp')}
282-
</div>
283-
)}
284282
<Disabled>
285283
<InterestGroups
286284
listData={listData}
287285
visibility={interest_groups_visibility}
288286
/>
289287
</Disabled>
288+
{show_required_indicator && (
289+
<div id="mc-indicates-required">
290+
{__('* = required field', 'mailchimp')}
291+
</div>
292+
)}
290293
<div className="mc_signup_submit">
291294
<RichText
292295
id="mc_signup_submit"

includes/blocks/mailchimp/editor.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
display: block;
2121
opacity: 0.2;
2222
border: 1px dashed grey;
23-
margin: 8px 0px;
2423
}
2524

2625
h2.mailchimp-block__header:has(span:empty),
@@ -58,9 +57,10 @@ div#mc_subheader:has(h3 span:empty) {
5857
text-align: center;
5958
}
6059

61-
.mc_merge_var {
62-
margin-bottom: 1.0em;
60+
.wp-block-mailchimp-mailchimp-form-field .mc_merge_var {
61+
margin-bottom: 1em;
6362
}
63+
6464
.mc_var_label,
6565
.mc_interest_label {
6666
display: block;
@@ -127,3 +127,7 @@ select.mc_select {
127127
.mc_email_type {
128128
padding-left: 4px;
129129
}
130+
#mc-indicates-required {
131+
width:100%;
132+
margin-top: 1em;
133+
}

includes/blocks/mailchimp/markup.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ function ( $single_list ) {
162162
.mc_email_type {
163163
padding-left: 4px;
164164
}
165+
#mc-indicates-required {
166+
width:100%;
167+
margin-top: 1em;
168+
}
165169
</style>
166170
<?php
167171
}
@@ -214,15 +218,6 @@ function ( $single_list ) {
214218
*/
215219
echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
216220

217-
// Show an explanation of the * if there's more than one field
218-
if ( $show_required_indicator ) {
219-
?>
220-
<div id="mc-indicates-required">
221-
* = <?php esc_html_e( 'required field', 'mailchimp' ); ?>
222-
</div><!-- /mc-indicates-required -->
223-
<?php
224-
}
225-
226221
// Show our Interest groups fields if we have them, and they're set to on
227222
if ( is_array( $igs ) && ! empty( $igs ) ) {
228223
foreach ( $igs as $ig ) {
@@ -252,6 +247,14 @@ function ( $single_list ) {
252247
}
253248
}
254249

250+
// Show an explanation of the * if there's more than one field
251+
if ( $show_required_indicator ) {
252+
?>
253+
<div id="mc-indicates-required">
254+
<?php esc_html_e( '* = required field', 'mailchimp' ); ?>
255+
</div><!-- /mc-indicates-required -->
256+
<?php
257+
}
255258
?>
256259
<div class="mc_signup_submit">
257260
<input type="submit" name="mc_signup_submit" id="mc_signup_submit" value="<?php echo esc_attr( $submit_text ); ?>" class="button" />

includes/class-mailchimp-block-form-submission.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Class responsible for admin side functionalities.
3+
* Class responsible for handling the form submission for the Mailchimp block.
44
*
55
* @package Mailchimp
66
*/

0 commit comments

Comments
 (0)