You are here

class DsRegionBlock in Display Suite 8.2

Same name in this branch
  1. 8.2 modules/ds_extras/src/Plugin/Derivative/DsRegionBlock.php \Drupal\ds_extras\Plugin\Derivative\DsRegionBlock
  2. 8.2 modules/ds_extras/src/Plugin/Block/DsRegionBlock.php \Drupal\ds_extras\Plugin\Block\DsRegionBlock
Same name and namespace in other branches
  1. 8.3 modules/ds_extras/src/Plugin/Derivative/DsRegionBlock.php \Drupal\ds_extras\Plugin\Derivative\DsRegionBlock

Provides block region definitions for ds blocks.

Hierarchy

Expanded class hierarchy of DsRegionBlock

See also

\Drupal\ds_extras\Plugin\block\block\DsRegionBlock

File

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

Namespace

Drupal\ds_extras\Plugin\Derivative
View source
class DsRegionBlock extends DeriverBase {

  /**
   * Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinitions().
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
DsRegionBlock::getDerivativeDefinitions public function Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinitions(). Overrides DeriverBase::getDerivativeDefinitions