You are here

private function MailchimpSignupForm::getMergevarOptions in Mailchimp 8

Same name and namespace in other branches
  1. 2.x modules/mailchimp_signup/src/Form/MailchimpSignupForm.php \Drupal\mailchimp_signup\Form\MailchimpSignupForm::getMergevarOptions()

Gets the mergevar options for the given lists.

Parameters

array $mc_lists: An array of list names.

Return value

array The mergevar options for the given lists.

2 calls to MailchimpSignupForm::getMergevarOptions()
MailchimpSignupForm::form in modules/mailchimp_signup/src/Form/MailchimpSignupForm.php
Gets the actual form array to be built.
MailchimpSignupForm::save in modules/mailchimp_signup/src/Form/MailchimpSignupForm.php
Form submission handler for the 'save' action.

File

modules/mailchimp_signup/src/Form/MailchimpSignupForm.php, line 499

Class

MailchimpSignupForm
Form controller for the MailchimpSignup entity edit form.

Namespace

Drupal\mailchimp_signup\Form

Code

private function getMergevarOptions(array $mc_lists) {
  $mergevar_settings = mailchimp_get_mergevars(array_filter($mc_lists));
  $mergevar_options = [];
  foreach ($mergevar_settings as $list_mergevars) {
    foreach ($list_mergevars as $mergevar) {
      if (isset($mergevar->public) && $mergevar->public) {
        $mergevar_options[$mergevar->tag] = $mergevar;
      }
    }
  }
  return $mergevar_options;
}