You are here

public function MailchimpSignupRoutes::routes in Mailchimp 8

Same name and namespace in other branches
  1. 2.x modules/mailchimp_signup/src/Routing/MailchimpSignupRoutes.php \Drupal\mailchimp_signup\Routing\MailchimpSignupRoutes::routes()
1 string reference to 'MailchimpSignupRoutes::routes'
mailchimp_signup.routing.yml in modules/mailchimp_signup/mailchimp_signup.routing.yml
modules/mailchimp_signup/mailchimp_signup.routing.yml

File

modules/mailchimp_signup/src/Routing/MailchimpSignupRoutes.php, line 15

Class

MailchimpSignupRoutes
Defines dynamic routes for Mailchimp signup forms rendered as pages.

Namespace

Drupal\mailchimp_signup\Routing

Code

public function routes() {
  $routes = [];
  $signups = mailchimp_signup_load_multiple();

  /* @var $signup \Drupal\mailchimp_signup\Entity\MailchimpSignup */
  foreach ($signups as $signup) {
    if (intval($signup->mode) == MAILCHIMP_SIGNUP_PAGE || intval($signup->mode) == MAILCHIMP_SIGNUP_BOTH) {
      $routes['mailchimp_signup.' . $signup->id] = new Route('/' . $signup->settings['path'], [
        '_controller' => '\\Drupal\\mailchimp_signup\\Controller\\MailchimpSignupController::page',
        '_title' => $signup->title,
        'signup_id' => $signup->id,
      ], [
        '_permission' => 'access mailchimp signup pages',
      ]);
    }
  }
  return $routes;
}