class TagBlock in Doubleclick for Publishers (DFP) 8
Same name in this branch
- 8 src/Plugin/Derivative/TagBlock.php \Drupal\dfp\Plugin\Derivative\TagBlock
- 8 src/Plugin/Block/TagBlock.php \Drupal\dfp\Plugin\Block\TagBlock
Retrieves block plugin definitions for all available DFP Ad tags.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\dfp\Plugin\Derivative\TagBlock implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of TagBlock
File
- src/
Plugin/ Derivative/ TagBlock.php, line 19 - Contains \Drupal\dfp\Plugin\Derivative\TagBlock.
Namespace
Drupal\dfp\Plugin\DerivativeView source
class TagBlock extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The DFP tag storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $tagStorage;
/**
* Constructs a TagBlock object.
*
* @param \Drupal\Core\Entity\EntityStorageInterface $tag_storage
* The DFP tag storage.
*/
public function __construct(EntityStorageInterface $tag_storage) {
$this->tagStorage = $tag_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
$entity_type_manager = $container
->get('entity_type.manager');
return new static($entity_type_manager
->getStorage('dfp_tag'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
/** @var \Drupal\dfp\Entity\TagInterface[] $tags */
$tags = $this->tagStorage
->loadMultiple();
foreach ($tags as $tag) {
if ($tag
->hasBlock()) {
$this->derivatives[$tag
->uuid()] = $base_plugin_definition;
$this->derivatives[$tag
->uuid()]['admin_label'] = $this
->t('DFP tag: @slotname', [
'@slotname' => $tag
->slot(),
]);
$this->derivatives[$tag
->uuid()]['config_dependencies']['config'] = [
$tag
->getConfigDependencyName(),
];
}
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
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:: |
|
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. | |
TagBlock:: |
protected | property | The DFP tag storage. | |
TagBlock:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
TagBlock:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
TagBlock:: |
public | function | Constructs a TagBlock object. |