You are here

public function DsRegionBlock::getDerivativeDefinitions in Display Suite 8.2

Same name and namespace in other branches
  1. 8.3 modules/ds_extras/src/Plugin/Derivative/DsRegionBlock.php \Drupal\ds_extras\Plugin\Derivative\DsRegionBlock::getDerivativeDefinitions()

Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinitions().

Overrides DeriverBase::getDerivativeDefinitions

File

modules/ds_extras/src/Plugin/Derivative/DsRegionBlock.php, line 17

Class

DsRegionBlock
Provides block region definitions for ds blocks.

Namespace

Drupal\ds_extras\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $region_blocks = \Drupal::config('ds_extras.settings')
    ->get('region_blocks');
  if (empty($region_blocks)) {
    return $this->derivatives;
  }
  foreach ($region_blocks as $key => $block) {
    $this->derivatives[$key] = $base_plugin_definition;
    $this->derivatives[$key]['delta'] = $key;
    $this->derivatives[$key]['admin_label'] = $block['title'];
  }
  return $this->derivatives;
}