public function testInitialState() { $this->assertTrue($this->ckEditorType->isEnable()); $this->assertSame('bundles/ckeditor/', $this->ckEditorType->getBasePath()); $this->assertSame('bundles/ckeditor/ckeditor.js', $this->ckEditorType->getJsPath()); $this->assertSame($this->configManagerMock, $this->ckEditorType->getConfigManager()); $this->assertSame($this->pluginManagerMock, $this->ckEditorType->getPluginManager()); $this->assertSame($this->stylesSetManagerMock, $this->ckEditorType->getStylesSetManager()); $this->assertSame($this->templateManagerMock, $this->ckEditorType->getTemplateManager()); }
/** * {@inheritdoc} */ public function buildView(FormView $view, FormInterface $form, array $options) { $ckeditorConfiguration = array('toolbar' => array_values($options['ckeditor_toolbar_icons'])); if ($options['ckeditor_context']) { $contextConfig = $this->CKEditorType->getConfigManager()->getConfig($options['ckeditor_context']); $ckeditorConfiguration = array_merge($ckeditorConfiguration, $contextConfig); } $view->vars['ckeditor_configuration'] = $ckeditorConfiguration; $view->vars['ckeditor_plugins'] = $options['ckeditor_plugins']; $view->vars['ckeditor_styles'] = $options['ckeditor_styles']; $view->vars['ckeditor_templates'] = $options['ckeditor_templates']; $view->vars['ckeditor_auto_inline'] = $options['ckeditor_auto_inline']; $view->vars['ckeditor_inline'] = $options['ckeditor_inline']; $view->vars['ckeditor_input_sync'] = $options['ckeditor_input_sync']; $view->vars['format'] = $options['format']; }
/** * {@inheritdoc} */ public function buildView(FormView $view, FormInterface $form, array $options) { if (is_array($options['source_field'])) { list($sourceField) = $options['source_field']; $view->vars['source_field'] = $sourceField; } else { $view->vars['source_field'] = $options['source_field']; } if (is_array($options['format_field'])) { list($formatField) = $options['format_field']; $view->vars['format_field'] = $formatField; } else { $view->vars['format_field'] = $options['format_field']; } $view->vars['format_field_options'] = $options['format_field_options']; $defaultConfig = $this->CKEditorType->getConfigManager()->getDefaultConfig(); if ($this->CKEditorType->getConfigManager()->hasConfig($defaultConfig)) { $ckeditorConfiguration = $this->CKEditorType->getConfigManager()->getConfig($defaultConfig); } else { $ckeditorConfiguration = array(); } if (!array_key_exists('toolbar', $ckeditorConfiguration)) { $ckeditorConfiguration['toolbar'] = array_values($options['ckeditor_toolbar_icons']); } if ($options['ckeditor_context']) { $contextConfig = $this->CKEditorType->getConfigManager()->getConfig($options['ckeditor_context']); $ckeditorConfiguration = array_merge($ckeditorConfiguration, $contextConfig); } $view->vars['ckeditor_configuration'] = $ckeditorConfiguration; $view->vars['ckeditor_basepath'] = $options['ckeditor_basepath']; $view->vars['ckeditor_plugins'] = $options['ckeditor_plugins']; $view->vars['ckeditor_styles'] = $options['ckeditor_styles']; $view->vars['ckeditor_templates'] = $options['ckeditor_templates']; $view->vars['ckeditor_auto_inline'] = $options['ckeditor_auto_inline']; $view->vars['ckeditor_inline'] = $options['ckeditor_inline']; $view->vars['ckeditor_input_sync'] = $options['ckeditor_input_sync']; $view->vars['source_id'] = str_replace($view->vars['name'], $view->vars['source_field'], $view->vars['id']); }