class SendinblueBlock in SendinBlue 8
Same name in this branch
- 8 src/Plugin/Derivative/SendinblueBlock.php \Drupal\sendinblue\Plugin\Derivative\SendinblueBlock
- 8 src/Plugin/Block/SendinblueBlock.php \Drupal\sendinblue\Plugin\Block\SendinblueBlock
Same name and namespace in other branches
- 8.2 src/Plugin/Derivative/SendinblueBlock.php \Drupal\sendinblue\Plugin\Derivative\SendinblueBlock
Provides block plugin definitions for sendinblue blocks.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\sendinblue\Plugin\Derivative\SendinblueBlock implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of SendinblueBlock
See also
\Drupal\sendinblue\Plugin\Block\SendinblueBlock
File
- src/
Plugin/ Derivative/ SendinblueBlock.php, line 17
Namespace
Drupal\sendinblue\Plugin\DerivativeView source
class SendinblueBlock extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* EntityTypeManagerInterface.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
private $entityTypeManager;
/**
* Block name.
*
* @var string
*/
private $blockName;
/**
* {@inheritdoc}
*/
public function __construct($blockName, EntityTypeManagerInterface $entityTypeManager) {
$this->entityTypeManager = $entityTypeManager;
$this->blockName = $blockName;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $blockName) {
return new static($blockName, $container
->get('entity_type.manager'));
}
/**
* Provide multiple blocks for sendinblue signup forms.
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$signups = $this->entityTypeManager
->getStorage(SendinblueManager::SENDINBLUE_SIGNUP_ENTITY)
->loadMultiple();
foreach ($signups as $signup) {
if ((int) $signup->mode->value == SendinblueManager::SENDINBLUE_SIGNUP_BLOCK || (int) $signup->mode->value == SendinblueManager::SENDINBLUE_SIGNUP_BOTH) {
$this->derivatives[$signup->mcsId->value] = $base_plugin_definition;
$this->derivatives[$signup->mcsId->value]['admin_label'] = $this
->t('SendinBlue Subscription Form: @name', [
'@name' => $signup->name->value,
]);
$this->derivatives[$signup->mcsId->value]['mcsId'] = $signup->mcsId->value;
}
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
SendinblueBlock:: |
private | property | Block name. | |
SendinblueBlock:: |
private | property | EntityTypeManagerInterface. | |
SendinblueBlock:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
SendinblueBlock:: |
public | function |
Provide multiple blocks for sendinblue signup forms. Overrides DeriverBase:: |
|
SendinblueBlock:: |
public | function | ||
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |