public function VueBlock::attachSettings in Decoupled Blocks: Vue.js 8
Attaches JavaScript settings required by the component.
Parameters
array $component: The component definition.
Return value
array Array of attachments.
Overrides PdbBlock::attachSettings
File
- src/
Plugin/ Block/ VueBlock.php, line 90
Class
- VueBlock
- Exposes a Vue component as a block.
Namespace
Drupal\pdb_vue\Plugin\BlockCode
public function attachSettings(array $component) {
$attached = [];
$config = $this->configFactory
->get('pdb_vue.settings');
if (isset($config)) {
$attached['drupalSettings']['pdbVue']['developmentMode'] = $config
->get('development_mode');
if ($config
->get('use_spa')) {
$attached['drupalSettings']['pdbVue']['spaElement'] = $config
->get('spa_element');
}
}
else {
$attached['drupalSettings']['pdbVue']['developmentMode'] = FALSE;
}
return $attached;
}