You are here

public function PdbBlock::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 FrameworkAwareBlockInterface::attachLibraries

3 calls to PdbBlock::attachLibraries()
Ng2Block::attachLibraries in modules/pdb_ng2/src/Plugin/Block/Ng2Block.php
Attaches any libraries required by the component.
PdbBlock::build in src/Plugin/Block/PdbBlock.php
Builds and returns the renderable array for this block plugin.
ReactBlock::attachLibraries in modules/pdb_react/src/Plugin/Block/ReactBlock.php
Attaches any libraries required by the component.
3 methods override PdbBlock::attachLibraries()
EmberBlock::attachLibraries in modules/pdb_ember/src/Plugin/Block/EmberBlock.php
Attaches any libraries required by the component.
Ng2Block::attachLibraries in modules/pdb_ng2/src/Plugin/Block/Ng2Block.php
Attaches any libraries required by the component.
ReactBlock::attachLibraries in modules/pdb_react/src/Plugin/Block/ReactBlock.php
Attaches any libraries required by the component.

File

src/Plugin/Block/PdbBlock.php, line 112

Class

PdbBlock
Class PdbBlock.

Namespace

Drupal\pdb\Plugin\Block

Code

public function attachLibraries(array $component) {

  // Attach the header and footer component library.
  $path = 'pdb/' . $component['machine_name'];
  $component_libraries = [];
  if (isset($component['add_css']['header']) || isset($component['add_js']['header'])) {
    $component_libraries[] = $path . '/header';
  }
  if (isset($component['add_css']['footer']) || isset($component['add_js']['footer'])) {
    $component_libraries[] = $path . '/footer';
  }
  return $component_libraries;
}