You are here

public function ReactBlock::attachLibraries in Decoupled Blocks 8

Attaches any libraries required by the component.

Parameters

array $component: The component definition.

Return value

array Array of attachments.

Overrides PdbBlock::attachLibraries

File

modules/pdb_react/src/Plugin/Block/ReactBlock.php, line 47

Class

ReactBlock
Exposes a React component as a block.

Namespace

Drupal\pdb_react\Plugin\Block

Code

public function attachLibraries(array $component) {
  $parent_libraries = parent::attachLibraries($component);
  $framework_libraries = [
    'pdb_react/react',
    'pdb_react/components',
  ];
  $libraries = [
    'library' => array_merge($parent_libraries, $framework_libraries),
  ];
  return $libraries;
}