Skip to content

Commit

Permalink
Fix manager services infected by local configs
Browse files Browse the repository at this point in the history
  • Loading branch information
GeLoLabs committed Sep 19, 2015
1 parent ee0dd51 commit 02d8927
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions Form/Type/CKEditorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,24 +322,27 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->setAttribute('js_path', $options['js_path']);
$builder->setAttribute('jquery_path', $options['jquery_path']);

$configManager = clone $this->configManager;
$pluginManager = clone $this->pluginManager;
$stylesSetManager = clone $this->stylesSetManager;
$templateManager = clone $this->templateManager;

$config = $options['config'];
if ($options['config_name'] === null) {
$name = uniqid('ivory', true);

$options['config_name'] = $name;
$this->configManager->setConfig($name, $config);
$options['config_name'] = uniqid('ivory', true);
$configManager->setConfig($options['config_name'], $config);
} else {
$this->configManager->mergeConfig($options['config_name'], $config);
$configManager->mergeConfig($options['config_name'], $config);
}

$this->pluginManager->setPlugins($options['plugins']);
$this->stylesSetManager->setStylesSets($options['styles']);
$this->templateManager->setTemplates($options['templates']);
$pluginManager->setPlugins($options['plugins']);
$stylesSetManager->setStylesSets($options['styles']);
$templateManager->setTemplates($options['templates']);

$builder->setAttribute('config', $this->configManager->getConfig($options['config_name']));
$builder->setAttribute('plugins', $this->pluginManager->getPlugins());
$builder->setAttribute('styles', $this->stylesSetManager->getStylesSets());
$builder->setAttribute('templates', $this->templateManager->getTemplates());
$builder->setAttribute('config', $configManager->getConfig($options['config_name']));
$builder->setAttribute('plugins', $pluginManager->getPlugins());
$builder->setAttribute('styles', $stylesSetManager->getStylesSets());
$builder->setAttribute('templates', $templateManager->getTemplates());
}
}

Expand Down

0 comments on commit 02d8927

Please sign in to comment.