You are here

public function ReactBlock::attachSettings in Decoupled Blocks 8

Attaches JavaScript settings required by the component.

Parameters

array $component: The component definition.

Return value

array Array of attachments.

Overrides PdbBlock::attachSettings

File

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

Class

ReactBlock
Exposes a React component as a block.

Namespace

Drupal\pdb_react\Plugin\Block

Code

public function attachSettings(array $component) {
  $machine_name = $component['machine_name'];
  $attached = [];
  $attached['drupalSettings']['react-apps'][$machine_name]['uri'] = '/' . $component['path'];
  return $attached;
}