You are here

public function EmberBlock::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_ember/src/Plugin/Block/EmberBlock.php, line 45

Class

EmberBlock
Exposes an Ember component as a block.

Namespace

Drupal\pdb_ember\Plugin\Block

Code

public function attachSettings(array $component) {
  $machine_name = $component['machine_name'];
  $uuid = $this->configuration['uuid'];
  $attached = [];
  $attached['drupalSettings']['ember']['components']['instance-id-' . $uuid] = [
    'uri' => '/' . $component['path'],
    'element' => $machine_name,
  ];
  $attached['drupalSettings']['apps'][$machine_name]['uri'] = '/' . $component['path'];
  return $attached;
}