Skip to content

Commit e256945

Browse files
authored
Added configuration options for remote and local storage (#25)
* Added configuration options for remote and local storage * Bugfix
1 parent e2561b9 commit e256945

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

DependencyInjection/Configuration.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ private function configsNode(ArrayNodeDefinition $root)
131131
->arrayNode('whitelist_domains')
132132
->prototype('scalar')->end()
133133
->end()
134+
->arrayNode('remote_storage')
135+
->info('Service ids with to classes that supports remote storage of translations.')
136+
->prototype('scalar')->end()
137+
->end()
138+
->arrayNode('local_storage')
139+
->info('Service ids with to classes that supports local storage of translations.')
140+
->prototype('scalar')->end()
141+
->end()
134142
->scalarNode('output_dir')->isRequired()->cannotBeEmpty()->end()
135143
->scalarNode('project_root')->info("The root dir of your project. By default this will be kernel_root's parent. ")->end()
136144
->end()

DependencyInjection/TranslationExtension.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,25 @@ public function load(array $configs, ContainerBuilder $container)
6464
$c['project_root'] = dirname($container->getParameter('kernel.root_dir'));
6565
}
6666

67-
$container->register('php_translation.storage.'.$name, StorageService::class);
67+
$storageDefinition = $container->register('php_translation.storage.'.$name, StorageService::class);
6868

6969
// Register a file storage
7070
$def = new DefinitionDecorator('php_translation.single_storage.file.abstract');
7171
$def->replaceArgument(2, $c['output_dir'])
7272
->addTag('php_translation.storage', ['type' => 'local', 'name' => $name]);
7373
$container->setDefinition('php_translation.single_storage.file.'.$name, $def);
74+
75+
// Add storages
76+
if (!empty($c['remote_storage'])) {
77+
foreach ($c['remote_storage'] as $serviceId) {
78+
$storageDefinition->addMethodCall('addRemoteStorage', [new Reference($serviceId)]);
79+
}
80+
}
81+
if (!empty($c['local_storage'])) {
82+
foreach ($c['local_storage'] as $serviceId) {
83+
$storageDefinition->addMethodCall('addLocalStorage', [new Reference($serviceId)]);
84+
}
85+
}
7486
}
7587

7688
if ($first !== null) {

Resources/public/js/symfonyProfiler.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
*/
55
function clearState(key) {
66
var row = document.getElementById(key);
7-
var cell = row.getElementsByClassName("state");
8-
cell[0].innerHTML = "";
97

108
// disable the checkbox
119
var inputs = row.getElementsByTagName("input");

0 commit comments

Comments
 (0)