function InlineBlockDeriver::getDerivativeDefinitions

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Plugin/Derivative/InlineBlockDeriver.php \Drupal\layout_builder\Plugin\Derivative\InlineBlockDeriver::getDerivativeDefinitions()
  2. 8.9.x core/modules/layout_builder/src/Plugin/Derivative/InlineBlockDeriver.php \Drupal\layout_builder\Plugin\Derivative\InlineBlockDeriver::getDerivativeDefinitions()
  3. 11.x core/modules/layout_builder/src/Plugin/Derivative/InlineBlockDeriver.php \Drupal\layout_builder\Plugin\Derivative\InlineBlockDeriver::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

File

core/modules/layout_builder/src/Plugin/Derivative/InlineBlockDeriver.php, line 47

Class

InlineBlockDeriver
Provides inline block plugin definitions for all block types.

Namespace

Drupal\layout_builder\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = [];
  if ($this->entityTypeManager
    ->hasDefinition('block_content_type')) {
    $block_content_types = $this->entityTypeManager
      ->getStorage('block_content_type')
      ->loadMultiple();
    foreach ($block_content_types as $id => $type) {
      $this->derivatives[$id] = $base_plugin_definition;
      $this->derivatives[$id]['admin_label'] = $type->label();
      $this->derivatives[$id]['config_dependencies'][$type->getConfigDependencyKey()][] = $type->getConfigDependencyName();
    }
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.