You are here

public function TagBlock::getDerivativeDefinitions in Doubleclick for Publishers (DFP) 8

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

src/Plugin/Derivative/TagBlock.php, line 52
Contains \Drupal\dfp\Plugin\Derivative\TagBlock.

Class

TagBlock
Retrieves block plugin definitions for all available DFP Ad tags.

Namespace

Drupal\dfp\Plugin\Derivative

Code

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);
}