You are here

public function MailingListController::subscribeForm in Mailing List 8

Returns a subscription form.

Parameters

\Drupal\mailing_list\MailingListInterface $mailing_list: The subscription's mailing list.

Return value

array The subscription add form.

1 string reference to 'MailingListController::subscribeForm'
mailing_list.routing.yml in ./mailing_list.routing.yml
mailing_list.routing.yml

File

src/Controller/MailingListController.php, line 96

Class

MailingListController
Returns responses for Mailing list routes.

Namespace

Drupal\mailing_list\Controller

Code

public function subscribeForm(MailingListInterface $mailing_list) {
  $subscription = $this
    ->entityTypeManager()
    ->getStorage('mailing_list_subscription')
    ->create([
    'mailing_list' => $mailing_list
      ->id(),
  ]);
  return $this
    ->entityFormBuilder()
    ->getForm($subscription);
}