You are here

public function WeatherSystemDisplayBlock::getDerivativeDefinitions in Weather 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Derivative/WeatherSystemDisplayBlock.php \Drupal\weather\Plugin\Derivative\WeatherSystemDisplayBlock::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

src/Plugin/Derivative/WeatherSystemDisplayBlock.php, line 50

Class

WeatherSystemDisplayBlock
Provides block plugin definitions for nodes.

Namespace

Drupal\weather\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $weatherDisplays = $this->weatherDisplayStorage
    ->loadByProperties([
    'type' => WeatherDisplayInterface::SYSTEM_WIDE_TYPE,
  ]);
  foreach ($weatherDisplays as $weatherDisplay) {
    $display_number = $weatherDisplay->number->value;
    $this->derivatives[$weatherDisplay
      ->id()] = $base_plugin_definition;
    $this->derivatives[$weatherDisplay
      ->id()]['admin_label'] = $this
      ->t('Weather: system-wide display (#@number)', [
      '@number' => $display_number,
    ]);
  }
  return $this->derivatives;
}