diff --git a/src/Plugin/WebformHandler/WebformMailChimpHandler.php b/src/Plugin/WebformHandler/WebformMailChimpHandler.php index 51e10c7..9531b62 100644 --- a/src/Plugin/WebformHandler/WebformMailChimpHandler.php +++ b/src/Plugin/WebformHandler/WebformMailChimpHandler.php @@ -100,6 +100,16 @@ class WebformMailChimpHandler extends WebformHandlerBase { '#attributes' => ['id' => 'webform-mailchimp-handler-settings'], ]; + $form['mailchimp']['update'] = [ + '#type' => 'submit', + '#value' => $this->t('Refresh lists & groups'), + '#ajax' => [ + 'callback' => [$this, 'ajaxMailchimpListHandler'], + 'wrapper' => 'webform-mailchimp-handler-settings', + ], + '#submit' => [[get_class($this), 'maichimpUpdateConfigSubmit']], + ]; + $form['mailchimp']['list'] = [ '#type' => 'webform_select_other', '#title' => $this->t('List'), @@ -188,24 +198,6 @@ class WebformMailChimpHandler extends WebformHandlerBase { $form['mailchimp']['token_tree_link'] = $this->tokenManager->buildTreeLink(); - - $form['mailchimp']['update_config'] = [ - '#type' => 'fieldset', - '#title' => $this->t('Update Mailchimp configuration'), - '#description' => $this->t('Fetch up to date Mailchimp configuration (new lists, groups, etc.).'), - '#attributes' => ['id' => 'webform-mailchimp-update-config'], - ]; - - $form['mailchimp']['update_config']['update'] = [ - '#type' => 'submit', - '#value' => $this->t('Update'), - '#ajax' => [ - 'callback' => [$this, 'ajaxMailchimpListHandler'], - 'wrapper' => 'webform-mailchimp-handler-settings', - ], - '#submit' => [[get_class($this), 'maichimpUpdateConfigSubmit']], - ]; - return $form; }