You are here

public function MailchimpSignupController::page in Mailchimp 8

Same name and namespace in other branches
  1. 2.x modules/mailchimp_signup/src/Controller/MailchimpSignupController.php \Drupal\mailchimp_signup\Controller\MailchimpSignupController::page()

View a Mailchimp signup form as a page.

Parameters

string $signup_id: The ID of the MailchimpSignup entity to view.

Return value

array Renderable array of page content.

File

modules/mailchimp_signup/src/Controller/MailchimpSignupController.php, line 62

Class

MailchimpSignupController
Mailchimp Signup controller.

Namespace

Drupal\mailchimp_signup\Controller

Code

public function page($signup_id) {
  $content = [];
  $signup = mailchimp_signup_load($signup_id);
  $form = new MailchimpSignupPageForm($this->messenger);
  $form_id = 'mailchimp_signup_subscribe_page_' . $signup->id . '_form';
  $form
    ->setFormID($form_id);
  $form
    ->setSignup($signup);
  $content = $this->formBuilder
    ->getForm($form);
  return $content;
}