You are here

public function MailchimpSignupSubscribeBlock::getDerivativeDefinitions in Mailchimp 2.x

Same name and namespace in other branches
  1. 8 modules/mailchimp_signup/src/Plugin/Derivative/MailchimpSignupSubscribeBlock.php \Drupal\mailchimp_signup\Plugin\Derivative\MailchimpSignupSubscribeBlock::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

modules/mailchimp_signup/src/Plugin/Derivative/MailchimpSignupSubscribeBlock.php, line 19

Class

MailchimpSignupSubscribeBlock
Provides block plugin definitions for Mailchimp Signup blocks.

Namespace

Drupal\mailchimp_signup\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $signups = mailchimp_signup_load_multiple();

  /* @var $signup \Drupal\mailchimp_signup\Entity\MailchimpSignup */
  foreach ($signups as $signup) {
    if (intval($signup->mode) == MAILCHIMP_SIGNUP_BLOCK || intval($signup->mode) == MAILCHIMP_SIGNUP_BOTH) {
      $this->derivatives[$signup->id] = $base_plugin_definition;
      $this->derivatives[$signup->id]['admin_label'] = $this
        ->t('Mailchimp Subscription Form: @name', [
        '@name' => $signup
          ->label(),
      ]);
    }
  }
  return $this->derivatives;
}