blockContentStorage = $block_content_storage; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, $base_plugin_id) { $entity_manager = $container->get('entity.manager'); return new static( $entity_manager->getStorage('block_content') ); } /** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $block_contents = $this->blockContentStorage->loadByProperties(['reusable' => TRUE]); // Reset the discovered definitions. $this->derivatives = []; /** @var $block_content \Drupal\block_content\Entity\BlockContent */ foreach ($block_contents as $block_content) { $this->derivatives[$block_content->uuid()] = $base_plugin_definition; $this->derivatives[$block_content->uuid()]['admin_label'] = $block_content->label(); $this->derivatives[$block_content->uuid()]['config_dependencies']['content'] = [ $block_content->getConfigDependencyName(), ]; } return parent::getDerivativeDefinitions($base_plugin_definition); } }