You are here

class MailchimpSignupSubscribeBlock in Mailchimp 8

Same name in this branch
  1. 8 modules/mailchimp_signup/src/Plugin/Derivative/MailchimpSignupSubscribeBlock.php \Drupal\mailchimp_signup\Plugin\Derivative\MailchimpSignupSubscribeBlock
  2. 8 modules/mailchimp_signup/src/Plugin/Block/MailchimpSignupSubscribeBlock.php \Drupal\mailchimp_signup\Plugin\Block\MailchimpSignupSubscribeBlock
Same name and namespace in other branches
  1. 2.x modules/mailchimp_signup/src/Plugin/Derivative/MailchimpSignupSubscribeBlock.php \Drupal\mailchimp_signup\Plugin\Derivative\MailchimpSignupSubscribeBlock

Provides block plugin definitions for Mailchimp Signup blocks.

Hierarchy

Expanded class hierarchy of MailchimpSignupSubscribeBlock

See also

\Drupal\mailchimp_signup\Plugin\Block\MailchimpSignupSubscribeBlock

File

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

Namespace

Drupal\mailchimp_signup\Plugin\Derivative
View source
class MailchimpSignupSubscribeBlock extends DeriverBase {
  use StringTranslationTrait;

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

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
MailchimpSignupSubscribeBlock::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.