Skip to content
Snippets Groups Projects
Commit 79012783 authored by Emmanuel Cortes's avatar Emmanuel Cortes Committed by Mark Miller
Browse files

Issue #3377783: Ember: remove incomplete pdb_ember submodule

parent 56432d0f
No related branches found
No related tags found
1 merge request!8Issue #3377783: Ember: remove incomplete pdb_ember submodule
/**
* @file
* Our main ember app.
*/
App = Ember.Application.extend({
rootElement: '#instance-id-emberexample1'
});
<?php
namespace Drupal\pdb_ember\Plugin\Block;
use Drupal\pdb\Plugin\Block\PdbBlock;
/**
* Exposes an Ember component as a block.
*
* @Block(
* id = "ember_component",
* admin_label = @Translation("Ember component"),
* deriver = "\Drupal\pdb_ember\Plugin\Derivative\EmberBlockDeriver"
* )
*/
class EmberBlock extends PdbBlock {
/**
* {@inheritdoc}
*/
public function build() {
$info = $this->getComponentInfo();
$machine_name = $info['machine_name'];
$build = parent::build();
$build['#allowed_tags'] = [$machine_name];
$build['#markup'] = '<' . $machine_name . ' id="instance-id-' . $machine_name . '">Test</' . $machine_name . '>';
return $build;
}
/**
* {@inheritdoc}
*/
public function attachFramework(array $component) {
$attached = [];
$attached['drupalSettings']['ember']['global_injectables'] = [];
return $attached;
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function attachLibraries(array $component) {
return [
'library' => [
'pdb_ember/ember',
'pdb_ember/app',
],
];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment