private function MailchimpCampaignForm::getMergeVarsFormElements in Mailchimp 8
Same name and namespace in other branches
- 2.x modules/mailchimp_campaign/src/Form/MailchimpCampaignForm.php \Drupal\mailchimp_campaign\Form\MailchimpCampaignForm::getMergeVarsFormElements()
Gets form elements used in the merge vars feature.
Parameters
array $merge_vars: Array of Mailchimp merge vars for the current list.
string $list_name: The name of the current list.
Return value
array Array of form elements used to display merge vars.
See also
mailchimp_get_mergevars
1 call to MailchimpCampaignForm::getMergeVarsFormElements()
- MailchimpCampaignForm::form in modules/
mailchimp_campaign/ src/ Form/ MailchimpCampaignForm.php - Gets the actual form array to be built.
File
- modules/
mailchimp_campaign/ src/ Form/ MailchimpCampaignForm.php, line 717
Class
- MailchimpCampaignForm
- Form controller for the MailchimpCampaign entity edit form.
Namespace
Drupal\mailchimp_campaign\FormCode
private function getMergeVarsFormElements(array $merge_vars, $list_name) {
$form = [];
$form['merge_vars'] = [
'#type' => 'container',
'#attributes' => [
'class' => [
'merge-vars-wrapper',
],
],
];
$merge_vars_url = Url::fromUri('https://admin.mailchimp.com/lists/', [
'attributes' => [
'target' => '_blank',
],
]);
$form['merge_vars']['content'] = [
'#type' => 'item',
'#title' => 'Mailchimp merge variables',
'#markup' => $this
->buildMergeVarsHtml($merge_vars),
'#description' => $this
->t('Insert merge variables from the %list_name audience or one of the @standard_link.', [
'%list_name' => $list_name,
'@standard_link' => Link::fromTextAndUrl($this
->t('standard Mailchimp merge variables'), $merge_vars_url)
->toString(),
]),
];
return $form;
}