You are here

MailchimpSignupRoutes.php in Mailchimp 8

Same filename and directory in other branches
  1. 2.x modules/mailchimp_signup/src/Routing/MailchimpSignupRoutes.php

File

modules/mailchimp_signup/src/Routing/MailchimpSignupRoutes.php
View source
<?php

namespace Drupal\mailchimp_signup\Routing;

use Symfony\Component\Routing\Route;

/**
 * Defines dynamic routes for Mailchimp signup forms rendered as pages.
 */
class MailchimpSignupRoutes {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Classes

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