From 02d892771f1e8434780df2b1dbc704bc12cb4ef2 Mon Sep 17 00:00:00 2001 From: GeLo Date: Sat, 19 Sep 2015 12:11:41 +0200 Subject: [PATCH] Fix manager services infected by local configs --- Form/Type/CKEditorType.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Form/Type/CKEditorType.php b/Form/Type/CKEditorType.php index 348c5d3d..009247ad 100644 --- a/Form/Type/CKEditorType.php +++ b/Form/Type/CKEditorType.php @@ -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()); } }