You are here

mailchimp_signup.module in Mailchimp 8

Creates signup forms integrated with Mailchimp.

File

modules/mailchimp_signup/mailchimp_signup.module
View source
<?php

/**
 * @file
 * Creates signup forms integrated with Mailchimp.
 */
use Drupal\mailchimp_signup\Entity\MailchimpSignup;
define('MAILCHIMP_SIGNUP_BLOCK', 1);
define('MAILCHIMP_SIGNUP_PAGE', 2);
define('MAILCHIMP_SIGNUP_BOTH', 3);

/**
 * Loads a single MailchimpSignup entity by ID.
 *
 * @param int $signup_id
 *   The ID of the MailchimpSignup entity to load.
 *
 * @return \Drupal\mailchimp_signup\Entity\MailchimpSignup
 *   The MailchimpSignup entity.
 */
function mailchimp_signup_load($signup_id) {
  return MailchimpSignup::load($signup_id);
}

/**
 * Loads multiple MailchimpSignup entities.
 *
 * @param array $signup_ids
 *   Array of MailchimpSignup entity IDs to load.
 * @param bool $reset
 *   TRUE to reset cache when loading MailchimpSignup entities.
 *
 * @return \Drupal\mailchimp_signup\Entity\MailchimpSignup[]
 *   Array of MailchimpSignup entities.
 */
function mailchimp_signup_load_multiple(array $signup_ids = [], $reset = FALSE) {
  if (empty($signup_ids)) {
    $signup_ids = NULL;
  }
  $controller = \Drupal::entityTypeManager()
    ->getStorage('mailchimp_signup');
  if ($reset) {
    $controller
      ->resetCache($signup_ids);
  }
  return $controller
    ->loadMultiple($signup_ids);
}

Functions

Namesort descending Description
mailchimp_signup_load Loads a single MailchimpSignup entity by ID.
mailchimp_signup_load_multiple Loads multiple MailchimpSignup entities.

Constants