What is the best approach to re-order the fields on the signup block? I would prefer the email to come after the First/Last name fields.

Comments

cmckay created an issue. See original summary.

Greg Boggs’s picture

Unfortunately, the MailChimp dashboard doesn't give you a way to move the email address on the MailChimp side. So, there are a few options. Starting with the fastest to the most complex:

1. Move it with jquery.
2. Write a hook_form_alter to reorder the fields.
3. Create a form using Drupal fields and the mailchimp field instead of using the signup block. This might require something like Entity Form.
4. Write a patch for MailChimp module to allow the fields to be reordered in the admin UI for signup block.

~Greg

cmckay’s picture

Thanks Greg!

Greg Boggs’s picture

Status: Active » Closed (works as designed)
Greg Boggs’s picture

If you come up with a good solution you want to share with the world, let us know!

cmckay’s picture

Greg, I actually had another idea. Shouldn't I be able to just specify the order in a template file?
I am able to use block--mailchimp_signup.html.twig to target the block, but cannot figure out the field names that I should be targeting.

Do you have any suggestions?

Greg Boggs’s picture

I've never tried to use a Twig template to build a drupal form. But, I believe it should work. My coworker's talk from DrupalCon will help you figure out how to do this:

https://events.drupal.org/baltimore2017/sessions/demystifying-rendered-c...

cmckay’s picture

Sweet thanks!

cmckay’s picture

Ugh - the video had some great tips, but didn't help with this use case. I just ended up doing this with JS.

Greg Boggs’s picture

Yea, I'm not really sure how to use Twig for a Drupal form. So, JS for the win. :)

junaidpv’s picture

I developed a patch implementing this feature as well as additional other customization. Please see #3390459: Customize display of signup fields.