From c34548910d809d34e1d82706710f1c9d6e9abba4 Mon Sep 17 00:00:00 2001 From: Florent VIOLLEAU Date: Sat, 10 Feb 2024 02:34:01 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8(feat)=20Migrate=20to=20CKEditor?= =?UTF-8?q?=205=20+=20allow=20back=20Php7.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 + composer.json | 2 +- docs/usage/ckeditor.rst | 10 +- src/Builder/JsonBuilder.php | 2 +- src/Command/CKEditorInstallerCommand.php | 10 +- src/Config/CKEditorConfiguration.php | 238 ++-------------- src/Config/CKEditorConfigurationInterface.php | 28 +- src/DependencyInjection/Configuration.php | 102 ++----- src/Form/Type/CKEditorType.php | 61 ++-- src/Installer/CKEditorInstaller.php | 38 +-- src/Installer/CKEditorPredefinedBuild.php | 28 ++ src/Renderer/CKEditorRenderer.php | 268 ++++++++---------- src/Renderer/CKEditorRendererInterface.php | 16 +- .../views/Form/ckeditor_widget.html.twig | 69 ++--- src/Twig/CKEditorExtension.php | 34 +-- .../AbstractFOSCKEditorExtensionTest.php | 190 ------------- tests/Fixtures/config/Yaml/auto_inline.yml | 4 +- tests/Form/Type/CKEditorTypeTest.php | 219 -------------- tests/Installer/CKEditorInstallerTest.php | 35 +-- tests/Renderer/CKEditorRendererTest.php | 14 +- tests/Template/AbstractTemplateTest.php | 4 +- 21 files changed, 319 insertions(+), 1057 deletions(-) create mode 100644 src/Installer/CKEditorPredefinedBuild.php diff --git a/.gitignore b/.gitignore index ead77b1f..3f1c45dd 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,7 @@ # Documentation /docs/_build/* + +# IDE +.idea +src/Resources/public diff --git a/composer.json b/composer.json index 0685a97e..dd382bf2 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ } ], "require": { - "php": "^8.0", + "php": "^7.4|^8.0", "ext-zip": "*", "ext-json": "*", "symfony/asset": "^5.4 || ^6.0 || ^7.0", diff --git a/docs/usage/ckeditor.rst b/docs/usage/ckeditor.rst index 3217ba17..9d6ac4bb 100644 --- a/docs/usage/ckeditor.rst +++ b/docs/usage/ckeditor.rst @@ -55,18 +55,18 @@ the bundle, you can use a custom path (absolute): CKEditor Release ~~~~~~~~~~~~~~~~ -You can choose which CKEditor release (full, standard or basic) to download: +You can choose which CKEditor release (classic, ballon, ballon-block, inline, document) to download: .. code-block:: bash - $ php bin/console ckeditor:install --release=basic + $ php bin/console ckeditor:install --release=classic CKEditor Custom Build ~~~~~~~~~~~~~~~~~~~~~ It's also possible to use custom build generated using CKEditor online builder: -https://ckeditor.com/cke4/builder. Download ZIP archive from CKEditor website -and use your custom build ID from `build-config.js` file: +https://ckeditor.com/ckeditor-5/online-builder/. Download ZIP archive from CKEditor website +and use your custom build ID from zip filename: .. code-block:: bash @@ -79,7 +79,7 @@ If your want a specific CKEditor version, you can use: .. code-block:: bash - $ php bin/console ckeditor:install --tag=4.6.0 + $ php bin/console ckeditor:install --tag=41.0.0 Silence Progress bars ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/Builder/JsonBuilder.php b/src/Builder/JsonBuilder.php index f73003b8..d1849fa5 100644 --- a/src/Builder/JsonBuilder.php +++ b/src/Builder/JsonBuilder.php @@ -83,7 +83,7 @@ public function setValues(array $values, string $pathPrefix = null): self return $this; } - public function setValue(string $path, mixed $value, bool $escapeValue = true): self + public function setValue(string $path, $value, bool $escapeValue = true): self { if (!$escapeValue) { $placeholder = uniqid('friendsofsymfony', true); diff --git a/src/Command/CKEditorInstallerCommand.php b/src/Command/CKEditorInstallerCommand.php index cfaae542..e8c7fe9b 100644 --- a/src/Command/CKEditorInstallerCommand.php +++ b/src/Command/CKEditorInstallerCommand.php @@ -82,15 +82,15 @@ protected function configure(): void The %command.name% command install CKEditor in your application: php %command.full_name% - + You can install it at a specific path (absolute): php %command.full_name% path - + You can install a specific release (basic, standard or full): php %command.full_name% --release=full - + You can install a specific version: php %command.full_name% --tag=4.7.0 @@ -99,13 +99,13 @@ protected function configure(): void php %command.full_name% --release=custom --custom-build-id=574a82a0d3e9226d94b0e91d10eaa372 -If there is a previous CKEditor installation detected, +If there is a previous CKEditor installation detected, you can control how it should be handled in non-interactive mode: php %command.full_name% --clear=drop php %command.full_name% --clear=keep php %command.full_name% --clear=skip - + You can exclude path(s) when extracting CKEditor: php %command.full_name% --exclude=samples --exclude=adapters diff --git a/src/Config/CKEditorConfiguration.php b/src/Config/CKEditorConfiguration.php index 1af49d0e..59f65d6d 100644 --- a/src/Config/CKEditorConfiguration.php +++ b/src/Config/CKEditorConfiguration.php @@ -16,117 +16,11 @@ final class CKEditorConfiguration implements CKEditorConfigurationInterface { - private $toolbarItems = [ - 'basic.about' => ['About'], - 'basic.basic_styles' => ['Bold', 'Italic'], - 'basic.links' => ['Link', 'Unlink'], - 'basic.paragraph' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'], - 'standard.about' => ['Styles', 'Format', 'About'], - 'standard.basic_styles' => ['Bold', 'Italic', 'Strike', '-', 'RemoveFormat'], - 'standard.clipboard' => ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'], - 'standard.document' => ['Source'], - 'standard.editing' => ['Scayt'], - 'standard.links' => ['Link', 'Unlink', 'Anchor'], - 'standard.insert' => ['Image', 'Table', 'HorizontalRule', 'SpecialChar'], - 'standard.paragraph' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'], - 'standard.tools' => ['Maximize'], - 'full.about' => ['About'], - 'full.basic_styles' => [ - 'Bold', - 'Italic', - 'Underline', - 'Strike', - 'Subscript', - 'Superscript', - '-', - 'RemoveFormat', - ], - 'full.clipboard' => ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'], - 'full.colors' => ['TextColor', 'BGColor'], - 'full.document' => ['Source', '-', 'NewPage', 'Preview', 'Print', '-', 'Templates'], - 'full.editing' => ['Find', 'Replace', '-', 'SelectAll', '-', 'Scayt'], - 'full.forms' => [ - 'Form', - 'Checkbox', - 'Radio', - 'TextField', - 'Textarea', - 'SelectField', - 'Button', - 'ImageButton', - 'HiddenField', - ], - 'full.insert' => ['Image', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar', 'Smiley', 'PageBreak', 'Iframe'], - 'full.links' => ['Link', 'Unlink', 'Anchor'], - 'full.paragraph' => [ - 'NumberedList', - 'BulletedList', - '-', - 'Outdent', - 'Indent', - '-', - 'Blockquote', - 'CreateDiv', - '-', - 'JustifyLeft', - 'JustifyCenter', - 'JustifyRight', - 'JustifyBlock', - '-', - 'BidiLtr', - 'BidiRtl', - ], - 'full.styles' => ['Styles', 'Format', 'Font', 'FontSize', 'TextColor', 'BGColor'], - 'full.tools' => ['Maximize', 'ShowBlocks'], - ]; - - private $toolbarConfigs = [ - 'basic' => [ - '@basic.basic_styles', - '@basic.paragraph', - '@basic.links', - '@basic.about', - ], - 'standard' => [ - '@standard.clipboard', - '@standard.editing', - '@standard.links', - '@standard.insert', - '@standard.tools', - '@standard.document', - '/', - '@standard.basic_styles', - '@standard.paragraph', - '@standard.about', - ], - 'full' => [ - '@full.document', - '@full.clipboard', - '@full.editing', - '@full.forms', - '/', - '@full.basic_styles', - '@full.paragraph', - '@full.links', - '@full.insert', - '/', - '@full.styles', - '@full.colors', - '@full.tools', - '@full.about', - ], - ]; - /** * @var bool */ private $enable; - /** - * @var bool - */ - private $async; - /** * @var bool */ @@ -135,32 +29,12 @@ final class CKEditorConfiguration implements CKEditorConfigurationInterface /** * @var bool */ - private $autoInline; - - /** - * @var bool - */ - private $inline; + private $poweredBy; /** * @var bool */ - private $jquery; - - /** - * @var bool - */ - private $requireJs; - - /** - * @var bool - */ - private $inputSync; - - /** - * @var array - */ - private $filebrowsers; + private $resize; /** * @var string @@ -172,11 +46,6 @@ final class CKEditorConfiguration implements CKEditorConfigurationInterface */ private $jsPath; - /** - * @var string - */ - private $jqueryPath; - /** * @var string|null */ @@ -187,10 +56,10 @@ final class CKEditorConfiguration implements CKEditorConfigurationInterface */ private $configs; - /** - * @var array - */ - private $templates; +// /** +// * @var array +// */ +// private $template; /** * @var array @@ -206,29 +75,18 @@ public function __construct(array $config) { if ($config['enable']) { $config = $this->resolveConfigs($config); - $config = $this->resolveStylesSet($config); } $this->enable = $config['enable']; - $this->async = $config['async']; $this->autoload = $config['autoload']; - $this->autoInline = $config['auto_inline']; - $this->inline = $config['inline']; - $this->jquery = $config['jquery']; - $this->requireJs = $config['require_js']; - $this->inputSync = $config['input_sync']; - $this->filebrowsers = $config['filebrowsers']; + $this->poweredBy = $config['poweredBy']; + $this->resize = $config['resize']; $this->basePath = $config['base_path']; $this->jsPath = $config['js_path']; - $this->jqueryPath = $config['jquery_path']; $this->defaultConfig = $config['default_config']; $this->plugins = $config['plugins']; $this->styles = $config['styles']; - $this->templates = $config['templates']; - $this->plugins = $config['plugins']; $this->configs = $config['configs']; - $this->toolbarConfigs = array_merge($this->toolbarConfigs, $config['toolbars']['configs']); - $this->toolbarItems = array_merge($this->toolbarItems, $config['toolbars']['items']); } /** @@ -252,94 +110,39 @@ private function resolveConfigs(array $config): array return $config; } - private function resolveStylesSet(array $config): array + public function getPlugins(): array { - if (empty($config['styles'])) { - return $config; - } - - $stylesSets = $config['styles']; - - foreach ($stylesSets as &$stylesSet) { - foreach ($stylesSet as &$value) { - $value = array_filter($value); - } - } - - return $config; + return $this->plugins; } - public function getToolbar(string $name): array - { - $items = []; - - foreach ($this->toolbarConfigs[$name] as $name => $item) { - $items[] = is_string($item) && '@' === substr($item, 0, 1) - ? $this->toolbarItems[substr($item, 1)] - : $item; - } - - return $items; - } +// public function getTemplate(): array +// { +// return $this->template; +// } public function getStyles(): array { return $this->styles; } - public function getPlugins(): array - { - return $this->plugins; - } - - public function getTemplates(): array - { - return $this->templates; - } - public function isEnable(): bool { return $this->enable; } - public function isAsync(): bool - { - return $this->async; - } - public function isAutoload(): bool { return $this->autoload; } - public function isAutoInline(): bool - { - return $this->autoInline; - } - - public function isInline(): bool + public function isPoweredBy(): bool { - return $this->inline; + return $this->poweredBy; } - public function isJquery(): bool + public function isResize(): bool { - return $this->jquery; - } - - public function isRequireJs(): bool - { - return $this->requireJs; - } - - public function isInputSync(): bool - { - return $this->inputSync; - } - - public function getFilebrowsers(): array - { - return $this->filebrowsers; + return $this->resize; } public function getBasePath(): string @@ -352,11 +155,6 @@ public function getJsPath(): string return $this->jsPath; } - public function getJqueryPath(): string - { - return $this->jqueryPath; - } - public function getDefaultConfig(): ?string { return $this->defaultConfig; diff --git a/src/Config/CKEditorConfigurationInterface.php b/src/Config/CKEditorConfigurationInterface.php index 30ae790e..67b11336 100644 --- a/src/Config/CKEditorConfigurationInterface.php +++ b/src/Config/CKEditorConfigurationInterface.php @@ -16,42 +16,26 @@ interface CKEditorConfigurationInterface { - public function getToolbar(string $name): array; - - public function getStyles(): array; - - public function getPlugins(): array; - - public function getTemplates(): array; - public function isEnable(): bool; - public function isAsync(): bool; - public function isAutoload(): bool; - public function isAutoInline(): bool; - - public function isInline(): bool; + public function isPoweredBy(): bool; - public function isJquery(): bool; - - public function isRequireJs(): bool; - - public function isInputSync(): bool; - - public function getFilebrowsers(): array; + public function isResize(): bool; public function getBasePath(): string; public function getJsPath(): string; - public function getJqueryPath(): string; - public function getDefaultConfig(): ?string; public function getConfigs(): array; + public function getPlugins(): array; + + public function getStyles(): array; + /** * @throws ConfigException */ diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 47afaeb7..9615caf7 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -35,23 +35,16 @@ public function getConfigTreeBuilder(): TreeBuilder $rootNode ->children() ->booleanNode('enable')->defaultTrue()->end() - ->booleanNode('async')->defaultFalse()->end() - ->booleanNode('auto_inline')->defaultTrue()->end() - ->booleanNode('inline')->defaultFalse()->end() ->booleanNode('autoload')->defaultTrue()->end() - ->booleanNode('jquery')->defaultFalse()->end() - ->booleanNode('require_js')->defaultFalse()->end() - ->booleanNode('input_sync')->defaultFalse()->end() + ->booleanNode('poweredBy')->defaultTrue()->end() + ->booleanNode('resize')->defaultTrue()->end() ->scalarNode('base_path')->defaultValue('bundles/fosckeditor/')->end() ->scalarNode('js_path')->defaultValue('bundles/fosckeditor/ckeditor.js')->end() - ->scalarNode('jquery_path')->defaultValue('bundles/fosckeditor/adapters/jquery.js')->end() ->scalarNode('default_config')->defaultValue(null)->end() ->append($this->createConfigsNode()) ->append($this->createPluginsNode()) +// ->append($this->createTemplateNode()) ->append($this->createStylesNode()) - ->append($this->createTemplatesNode()) - ->append($this->createFilebrowsersNode()) - ->append($this->createToolbarsNode()) ->end(); return $treeBuilder; @@ -78,75 +71,32 @@ private function createPluginsNode(): ArrayNodeDefinition ->end(); } +// private function createTemplateNode(): ArrayNodeDefinition +// { +// return $this->createPrototypeNode('template') +// ->arrayPrototype() +// ->children() +// ->scalarNode('imagesPath')->end() +// ->arrayNode('templates') +// ->arrayPrototype() +// ->children() +// ->scalarNode('title')->end() +// ->scalarNode('image')->end() +// ->scalarNode('description')->end() +// ->scalarNode('html')->end() +// ->scalarNode('template')->end() +// ->append($this->createPrototypeNode('template_parameters')->prototype('scalar')->end()) +// ->end() +// ->end() +// ->end() +// ->end() +// ->end(); +// } + private function createStylesNode(): ArrayNodeDefinition { return $this->createPrototypeNode('styles') - ->arrayPrototype() - ->arrayPrototype() - ->children() - ->scalarNode('name')->end() - ->scalarNode('type')->end() - ->scalarNode('widget')->end() - ->variableNode('element')->end() - ->append($this->createPrototypeNode('styles')->prototype('scalar')->end()) - ->append($this->createPrototypeNode('attributes')->prototype('scalar')->end()) - ->end() - ->end() - ->end(); - } - - private function createTemplatesNode(): ArrayNodeDefinition - { - return $this->createPrototypeNode('templates') - ->arrayPrototype() - ->children() - ->scalarNode('imagesPath')->end() - ->arrayNode('templates') - ->arrayPrototype() - ->children() - ->scalarNode('title')->end() - ->scalarNode('image')->end() - ->scalarNode('description')->end() - ->scalarNode('html')->end() - ->scalarNode('template')->end() - ->append($this->createPrototypeNode('template_parameters')->prototype('scalar')->end()) - ->end() - ->end() - ->end() - ->end() - ->end(); - } - - private function createFilebrowsersNode(): ArrayNodeDefinition - { - $node = $this->createNode('filebrowsers') - ->useAttributeAsKey('name') - ->scalarPrototype() - ->end(); - - \assert($node instanceof ArrayNodeDefinition); - - return $node; - } - - private function createToolbarsNode(): ArrayNodeDefinition - { - return $this->createNode('toolbars') - ->addDefaultsIfNotSet() - ->children() - ->arrayNode('configs') - ->useAttributeAsKey('name') - ->arrayPrototype() - ->variablePrototype()->end() - ->end() - ->end() - ->arrayNode('items') - ->useAttributeAsKey('name') - ->arrayPrototype() - ->variablePrototype()->end() - ->end() - ->end() - ->end(); + ->variablePrototype()->end(); } private function createPrototypeNode(string $name): ArrayNodeDefinition diff --git a/src/Form/Type/CKEditorType.php b/src/Form/Type/CKEditorType.php index d06799b5..ab0e6959 100644 --- a/src/Form/Type/CKEditorType.php +++ b/src/Form/Type/CKEditorType.php @@ -18,7 +18,6 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; -use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; /** @@ -44,22 +43,16 @@ public function buildForm(FormBuilderInterface $builder, array $options): void return; } - $builder->setAttribute('async', $options['async']); $builder->setAttribute('autoload', $options['autoload']); - $builder->setAttribute('auto_inline', $options['auto_inline']); - $builder->setAttribute('inline', $options['inline']); - $builder->setAttribute('jquery', $options['jquery']); - $builder->setAttribute('require_js', $options['require_js']); - $builder->setAttribute('input_sync', $options['input_sync']); - $builder->setAttribute('filebrowsers', $options['filebrowsers']); + $builder->setAttribute('poweredBy', $options['poweredBy']); + $builder->setAttribute('resize', $options['resize']); $builder->setAttribute('base_path', $options['base_path']); $builder->setAttribute('js_path', $options['js_path']); - $builder->setAttribute('jquery_path', $options['jquery_path']); $builder->setAttribute('config', $this->resolveConfig($options)); $builder->setAttribute('config_name', $options['config_name']); $builder->setAttribute('plugins', array_merge($this->configuration->getPlugins(), $options['plugins'])); $builder->setAttribute('styles', array_merge($this->configuration->getStyles(), $options['styles'])); - $builder->setAttribute('templates', array_merge($this->configuration->getTemplates(), $options['templates'])); +// $builder->setAttribute('template', array_merge($this->configuration->getTemplate(), $options['template'])); } private function resolveConfig(array $options): array @@ -88,22 +81,16 @@ public function buildView(FormView $view, FormInterface $form, array $options): return; } - $view->vars['async'] = $config->getAttribute('async'); $view->vars['autoload'] = $config->getAttribute('autoload'); - $view->vars['auto_inline'] = $config->getAttribute('auto_inline'); - $view->vars['inline'] = $config->getAttribute('inline'); - $view->vars['jquery'] = $config->getAttribute('jquery'); - $view->vars['require_js'] = $config->getAttribute('require_js'); - $view->vars['input_sync'] = $config->getAttribute('input_sync'); - $view->vars['filebrowsers'] = $config->getAttribute('filebrowsers'); + $view->vars['poweredBy'] = $config->getAttribute('poweredBy'); + $view->vars['resize'] = $config->getAttribute('resize'); $view->vars['base_path'] = $config->getAttribute('base_path'); $view->vars['js_path'] = $config->getAttribute('js_path'); - $view->vars['jquery_path'] = $config->getAttribute('jquery_path'); $view->vars['config'] = $config->getAttribute('config'); $view->vars['config_name'] = $config->getAttribute('config_name'); $view->vars['plugins'] = $config->getAttribute('plugins'); $view->vars['styles'] = $config->getAttribute('styles'); - $view->vars['templates'] = $config->getAttribute('templates'); +// $view->vars['template'] = $config->getAttribute('template'); } public function configureOptions(OptionsResolver $resolver): void @@ -111,51 +98,37 @@ public function configureOptions(OptionsResolver $resolver): void $resolver ->setDefaults([ 'enable' => $this->configuration->isEnable(), - 'async' => $this->configuration->isAsync(), 'autoload' => $this->configuration->isAutoload(), - 'auto_inline' => $this->configuration->isAutoInline(), - 'inline' => $this->configuration->isInline(), - 'jquery' => $this->configuration->isJquery(), - 'require_js' => $this->configuration->isRequireJs(), - 'input_sync' => $this->configuration->isInputSync(), - 'filebrowsers' => $this->configuration->getFilebrowsers(), + 'poweredBy' => $this->configuration->isPoweredBy(), + 'resize' => $this->configuration->isResize(), 'base_path' => $this->configuration->getBasePath(), 'js_path' => $this->configuration->getJsPath(), - 'jquery_path' => $this->configuration->getJqueryPath(), 'config_name' => $this->configuration->getDefaultConfig(), 'config' => [], 'plugins' => [], 'styles' => [], - 'templates' => [], +// 'template' => [], ]) ->addAllowedTypes('enable', 'bool') - ->addAllowedTypes('async', 'bool') ->addAllowedTypes('autoload', 'bool') - ->addAllowedTypes('auto_inline', 'bool') - ->addAllowedTypes('inline', 'bool') - ->addAllowedTypes('jquery', 'bool') - ->addAllowedTypes('require_js', 'bool') - ->addAllowedTypes('input_sync', 'bool') - ->addAllowedTypes('filebrowsers', 'array') + ->addAllowedTypes('poweredBy', 'bool') + ->addAllowedTypes('resize', 'bool') ->addAllowedTypes('config_name', ['string', 'null']) ->addAllowedTypes('base_path', 'string') ->addAllowedTypes('js_path', 'string') - ->addAllowedTypes('jquery_path', 'string') ->addAllowedTypes('config', 'array') + ->addAllowedTypes('config_name', ['string', 'null']) ->addAllowedTypes('plugins', 'array') ->addAllowedTypes('styles', 'array') - ->addAllowedTypes('templates', 'array') - ->setNormalizer('base_path', function (Options $options, $value) { - if ('/' !== substr($value, -1)) { - $value .= '/'; - } - - return $value; - }); +// ->addAllowedTypes('template', 'array') + ; } public function getParent(): string { + // The only editor type which can be initialized on - {% if enable and not async %} + {% if enable %} {{ block('_ckeditor_javascript') }} {% endif %} {% endblock %} {% block ckeditor_javascript %} - {% if enable and async %} + {% if enable %} {{ block('_ckeditor_javascript') }} {% endif %} {% endblock %} {% block _ckeditor_javascript %} {% if autoload %} - + - {% if jquery %} - - {% endif %} {% endif %} - #} +{# {% endfor %}#} + {% endblock %} diff --git a/src/Twig/CKEditorExtension.php b/src/Twig/CKEditorExtension.php index b1e10346..31a43933 100644 --- a/src/Twig/CKEditorExtension.php +++ b/src/Twig/CKEditorExtension.php @@ -36,19 +36,16 @@ public function getFunctions(): array $options = ['is_safe' => ['html']]; return [ - new TwigFunction('ckeditor_base_path', [$this, 'renderBasePath'], $options), + new TwigFunction('ckeditor_translation_path', [$this, 'renderTranslationPath'], $options), new TwigFunction('ckeditor_js_path', [$this, 'renderJsPath'], $options), new TwigFunction('ckeditor_widget', [$this, 'renderWidget'], $options), - new TwigFunction('ckeditor_destroy', [$this, 'renderDestroy'], $options), - new TwigFunction('ckeditor_plugin', [$this, 'renderPlugin'], $options), - new TwigFunction('ckeditor_styles_set', [$this, 'renderStylesSet'], $options), - new TwigFunction('ckeditor_template', [$this, 'renderTemplate'], $options), + new TwigFunction('ckeditor_size', [$this, 'renderSize'], $options), ]; } - public function renderBasePath(string $basePath): string + public function renderTranslationPath(string $basePath): string { - return $this->renderer->renderBasePath($basePath); + return $this->renderer->renderTranslationPath($basePath); } public function renderJsPath(string $jsPath): string @@ -56,29 +53,14 @@ public function renderJsPath(string $jsPath): string return $this->renderer->renderJsPath($jsPath); } - public function renderWidget(string $id, array $config, array $options = []): string + public function renderSize(array $config): string { - return $this->renderer->renderWidget($id, $config, $options); + return $this->renderer->renderSize($config); } - public function renderDestroy(string $id): string - { - return $this->renderer->renderDestroy($id); - } - - public function renderPlugin(string $name, array $plugin): string - { - return $this->renderer->renderPlugin($name, $plugin); - } - - public function renderStylesSet(string $name, array $stylesSet): string - { - return $this->renderer->renderStylesSet($name, $stylesSet); - } - - public function renderTemplate(string $name, array $template): string + public function renderWidget(string $id, array $config, array $options = []): string { - return $this->renderer->renderTemplate($name, $template); + return $this->renderer->renderWidget($id, $config, $options); } public function getName(): string diff --git a/tests/DependencyInjection/AbstractFOSCKEditorExtensionTest.php b/tests/DependencyInjection/AbstractFOSCKEditorExtensionTest.php index f72e12fd..a1beae39 100644 --- a/tests/DependencyInjection/AbstractFOSCKEditorExtensionTest.php +++ b/tests/DependencyInjection/AbstractFOSCKEditorExtensionTest.php @@ -122,16 +122,8 @@ public function testFormType(): void $vars = $this->getVars(); $this->assertTrue($vars['enable']); - $this->assertTrue($vars['autoload']); - $this->assertTrue($vars['auto_inline']); - $this->assertFalse($vars['inline']); - $this->assertFalse($vars['jquery']); - $this->assertFalse($vars['input_sync']); - $this->assertFalse($vars['require_js']); - $this->assertEmpty($vars['filebrowsers']); $this->assertSame('bundles/fosckeditor/', $vars['base_path']); $this->assertSame('bundles/fosckeditor/ckeditor.js', $vars['js_path']); - $this->assertSame('bundles/fosckeditor/adapters/jquery.js', $vars['jquery_path']); } private function getVars(): array @@ -164,86 +156,6 @@ public function testDisable(): void $this->assertFalse($vars['enable']); } - public function testAsync(): void - { - $this->loadConfiguration($this->container, 'async'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertTrue($vars['async']); - } - - public function testAutoload(): void - { - $this->loadConfiguration($this->container, 'autoload'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertFalse($vars['autoload']); - } - - public function testAutoInline(): void - { - $this->loadConfiguration($this->container, 'auto_inline'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertFalse($vars['auto_inline']); - } - - public function testInline(): void - { - $this->loadConfiguration($this->container, 'inline'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertTrue($vars['inline']); - } - - public function testInputSync(): void - { - $this->loadConfiguration($this->container, 'input_sync'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertTrue($vars['input_sync']); - } - - public function testRequireJs(): void - { - $this->loadConfiguration($this->container, 'require_js'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertTrue($vars['require_js']); - } - - public function testJquery(): void - { - $this->loadConfiguration($this->container, 'jquery'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertTrue($vars['jquery']); - } - - public function testJqueryPath(): void - { - $this->loadConfiguration($this->container, 'jquery_path'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertSame('foo/jquery.js', $vars['jquery_path']); - } - public function testCustomPaths(): void { $this->loadConfiguration($this->container, 'custom_paths'); @@ -255,19 +167,6 @@ public function testCustomPaths(): void $this->assertSame('foo/ckeditor.js', $vars['js_path']); } - public function testFilebrowsers(): void - { - $this->loadConfiguration($this->container, 'filebrowsers'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertSame( - ['VideoBrowse', 'VideoUpload'], - $vars['filebrowsers'] - ); - } - public function testPlugins(): void { $this->loadConfiguration($this->container, 'plugins'); @@ -283,95 +182,6 @@ public function testPlugins(): void ], $vars['plugins']); } - public function testStylesSets(): void - { - $this->loadConfiguration($this->container, 'styles_sets'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertSame([ - 'styles-set-name' => [ - [ - 'name' => 'Blue Title', - 'element' => 'h2', - 'styles' => ['text-decoration' => 'underline'], - 'attributes' => [], - ], - [ - 'name' => 'CSS Style', - 'element' => 'span', - 'attributes' => ['data-class' => 'my-style'], - 'styles' => [], - ], - [ - 'name' => 'Widget Style', - 'type' => 'widget', - 'widget' => 'my-widget', - 'attributes' => ['data-class' => 'my-style'], - 'styles' => [], - ], - [ - 'name' => 'Multiple Elements Style', - 'element' => ['span', 'p', 'h3'], - 'attributes' => ['data-class' => 'my-style'], - 'styles' => [], - ], - ], - ], $vars['styles']); - } - - public function testTemplates(): void - { - $this->loadConfiguration($this->container, 'templates'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertSame([ - 'template-name' => [ - 'imagesPath' => '/my/path', - 'templates' => [ - [ - 'title' => 'My Template', - 'image' => 'image.jpg', - 'description' => 'My awesome description', - 'html' => '

Template

Type your text here.

', - 'template' => 'AppBundle:CKEditor:template.html.twig', - 'template_parameters' => ['foo' => 'bar'], - ], - ], - ], - ], $vars['templates']); - } - - public function testToolbars(): void - { - $this->loadConfiguration($this->container, 'toolbars'); - $this->container->compile(); - - $vars = $this->getVars(); - - $this->assertSame( - [ - [ - 'Source', - '-', - 'Save', - ], - '/', - [ - 'Anchor', - ], - '/', - [ - 'Maximize', - ], - ], - $vars['config']['toolbar'] - ); - } - public function testInvalidDefaultConfig(): void { $this->expectException(ConfigException::class); diff --git a/tests/Fixtures/config/Yaml/auto_inline.yml b/tests/Fixtures/config/Yaml/auto_inline.yml index 07d267e4..e3ff56ab 100644 --- a/tests/Fixtures/config/Yaml/auto_inline.yml +++ b/tests/Fixtures/config/Yaml/auto_inline.yml @@ -1,2 +1,2 @@ -fos_ck_editor: - auto_inline: false +#fos_ck_editor: +# auto_inline: false diff --git a/tests/Form/Type/CKEditorTypeTest.php b/tests/Form/Type/CKEditorTypeTest.php index bea3f405..1af40250 100644 --- a/tests/Form/Type/CKEditorTypeTest.php +++ b/tests/Form/Type/CKEditorTypeTest.php @@ -72,154 +72,6 @@ public function testEnableWithExplicitValue(): void $this->assertFalse($view->vars['enable']); } - public function testAsyncWithDefaultValue(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertArrayHasKey('async', $view->vars); - $this->assertFalse($view->vars['async']); - } - - public function testAsyncWithExplicitValue(): void - { - $form = $this->factory->create($this->formType, null, ['async' => true]); - $view = $form->createView(); - - $this->assertArrayHasKey('async', $view->vars); - $this->assertTrue($view->vars['async']); - } - - public function testAutoloadWithDefaultValue(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertArrayHasKey('autoload', $view->vars); - $this->assertTrue($view->vars['autoload']); - } - - public function testAutoloadWithExplicitValue(): void - { - $form = $this->factory->create($this->formType, null, ['autoload' => false]); - $view = $form->createView(); - - $this->assertArrayHasKey('autoload', $view->vars); - $this->assertFalse($view->vars['autoload']); - } - - public function testAutoInlineWithDefaultValue(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertArrayHasKey('auto_inline', $view->vars); - $this->assertTrue($view->vars['auto_inline']); - } - - public function testAutoInlineWithExplicitValue(): void - { - $form = $this->factory->create($this->formType, null, ['auto_inline' => false]); - $view = $form->createView(); - - $this->assertArrayHasKey('auto_inline', $view->vars); - $this->assertFalse($view->vars['auto_inline']); - } - - public function testInlineWithDefaultValue(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertArrayHasKey('inline', $view->vars); - $this->assertFalse($view->vars['inline']); - } - - public function testInlineWithExplicitValue(): void - { - $form = $this->factory->create($this->formType, null, ['inline' => true]); - $view = $form->createView(); - - $this->assertArrayHasKey('inline', $view->vars); - $this->assertTrue($view->vars['inline']); - } - - public function testJqueryWithDefaultValue(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertArrayHasKey('jquery', $view->vars); - $this->assertFalse($view->vars['jquery']); - } - - public function testJqueryWithExplicitValue(): void - { - $form = $this->factory->create($this->formType, null, ['jquery' => true]); - $view = $form->createView(); - - $this->assertArrayHasKey('jquery', $view->vars); - $this->assertTrue($view->vars['jquery']); - } - - public function testInputSyncWithDefaultValue(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertArrayHasKey('input_sync', $view->vars); - $this->assertFalse($view->vars['input_sync']); - } - - public function testInputSyncWithExplicitValue(): void - { - $form = $this->factory->create($this->formType, null, ['input_sync' => true]); - $view = $form->createView(); - - $this->assertArrayHasKey('input_sync', $view->vars); - $this->assertTrue($view->vars['input_sync']); - } - - public function testRequireJsWithDefaultValue(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertArrayHasKey('require_js', $view->vars); - $this->assertFalse($view->vars['require_js']); - } - - public function testRequireJsWithExplicitValue(): void - { - $form = $this->factory->create($this->formType, null, ['require_js' => true]); - $view = $form->createView(); - - $this->assertArrayHasKey('require_js', $view->vars); - $this->assertTrue($view->vars['require_js']); - } - - public function testFilebrowsersWithDefaultValue(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertArrayHasKey('filebrowsers', $view->vars); - $this->assertEmpty($view->vars['filebrowsers']); - } - - public function testFilebrowsersWithExplicitValue(): void - { - $form = $this->factory->create($this->formType, null, ['filebrowsers' => $filebrowsers = [ - 'VideoBrowse', - 'VideoUpload', - ]]); - - $view = $form->createView(); - - $this->assertArrayHasKey('filebrowsers', $view->vars); - $this->assertSame($filebrowsers, $view->vars['filebrowsers']); - } - public function testBaseAndJsPathWithDefaultValues(): void { $form = $this->factory->create($this->formType); @@ -252,24 +104,6 @@ public function testBaseAndJsPathWithExplicitValues(): void $this->assertSame('foo/ckeditor.js', $view->vars['js_path']); } - public function testJqueryPathWithDefaultValue(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertArrayHasKey('jquery_path', $view->vars); - $this->assertSame('bundles/fosckeditor/adapters/jquery.js', $view->vars['jquery_path']); - } - - public function testJqueryPathWithExplicitValue(): void - { - $form = $this->factory->create($this->formType, null, ['jquery_path' => 'foo/jquery.js']); - $view = $form->createView(); - - $this->assertArrayHasKey('jquery_path', $view->vars); - $this->assertSame('foo/jquery.js', $view->vars['jquery_path']); - } - public function testDefaultConfig(): void { $form = $this->factory->create($this->formType); @@ -321,59 +155,6 @@ public function testPluginsWithExplicitPlugins(): void $this->assertSame($plugins, $view->vars['plugins']); } - public function testDefaultStylesSet(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertEmpty($view->vars['styles']); - } - - public function testPluginsWithExplicitStylesSet(): void - { - $stylesSets = [ - 'default' => [ - ['name' => 'Blue Title', 'element' => 'h2', 'styles' => ['color' => 'Blue']], - ['name' => 'CSS Style', 'element' => 'span', 'attributes' => ['class' => 'my_style']], - ], - ]; - - $form = $this->factory->create($this->formType, null, ['styles' => $stylesSets]); - - $view = $form->createView(); - - $this->assertSame($stylesSets, $view->vars['styles']); - } - - public function testDefaultTemplates(): void - { - $form = $this->factory->create($this->formType); - $view = $form->createView(); - - $this->assertEmpty($view->vars['templates']); - } - - public function testTemplatesWithExplicitTemplates(): void - { - $templates = [ - 'default' => [ - 'imagesPath' => '/my/path', - 'templates' => [ - [ - 'title' => 'My Template', - 'html' => '

Template

Type your text here.

', - ], - ], - ], - ]; - - $form = $this->factory->create($this->formType, null, ['templates' => $templates]); - - $view = $form->createView(); - - $this->assertSame($templates, $view->vars['templates']); - } - public function testExplicitDisable(): void { $options = [ diff --git a/tests/Installer/CKEditorInstallerTest.php b/tests/Installer/CKEditorInstallerTest.php index 50ae8264..aeead04a 100644 --- a/tests/Installer/CKEditorInstallerTest.php +++ b/tests/Installer/CKEditorInstallerTest.php @@ -13,6 +13,7 @@ namespace FOS\CKEditorBundle\Tests\Installer; use FOS\CKEditorBundle\Exception\BadProxyUrlException; +use FOS\CKEditorBundle\Installer\CKEditorPredefinedBuild; use FOS\CKEditorBundle\Installer\CKEditorInstaller; use PHPUnit\Framework\TestCase; @@ -69,14 +70,14 @@ public function testInstallWithPath(): void public function testInstallWithRelease(): void { - $this->installer->install($options = ['release' => CKEditorInstaller::RELEASE_BASIC]); + $this->installer->install($options = ['release' => CKEditorPredefinedBuild::RELEASE_CLASSIC]); $this->assertInstall($options); } public function testInstallWithCustomBuild(): void { - $this->installer->install($options = ['release' => CKEditorInstaller::RELEASE_CUSTOM, 'custom_build_id' => 'ffbb0c61721cb8543bfa54315374592d']); + $this->installer->install($options = ['release' => CKEditorPredefinedBuild::RELEASE_CUSTOM, 'custom_build_id' => 'ffbb0c61721cb8543bfa54315374592d']); $this->assertInstall($options); } @@ -99,7 +100,7 @@ public function testInstallWithCustomBuildWithMissingId(): void public function testInstallWithVersion(): void { - $this->installer->install($options = ['version' => '4.6.0']); + $this->installer->install($options = ['version' => '41.0.0']); $this->assertInstall($options); } @@ -201,8 +202,8 @@ public function testReinstallWithClearDrop(): void { $this->installer->install(); $this->installer->install($options = [ - 'release' => CKEditorInstaller::RELEASE_BASIC, - 'clear' => CKEditorInstaller::CLEAR_DROP, + 'release' => CKEditorPredefinedBuild::RELEASE_CLASSIC, + 'clear' => CKEditorPredefinedBuild::CLEAR_DROP, ]); $this->assertInstall($options); @@ -210,11 +211,11 @@ public function testReinstallWithClearDrop(): void public function testReinstallWithClearKeep(): void { - $this->installer->install(['release' => CKEditorInstaller::RELEASE_BASIC]); + $this->installer->install(['release' => CKEditorPredefinedBuild::RELEASE_CLASSIC]); $this->installer->install($options = [ - 'version' => '4.6.0', - 'release' => CKEditorInstaller::RELEASE_FULL, - 'clear' => CKEditorInstaller::CLEAR_KEEP, + 'version' => '41.0.0', + 'release' => CKEditorPredefinedBuild::RELEASE_CLASSIC, + 'clear' => CKEditorPredefinedBuild::CLEAR_KEEP, ]); $this->assertInstall($options); @@ -222,8 +223,8 @@ public function testReinstallWithClearKeep(): void public function testReinstallWithClearSkip(): void { - $this->installer->install($options = ['version' => '4.6.0']); - $this->installer->install(['clear' => CKEditorInstaller::CLEAR_SKIP]); + $this->installer->install($options = ['version' => '41.0.0']); + $this->installer->install(['clear' => CKEditorPredefinedBuild::CLEAR_SKIP]); $this->assertInstall($options); } @@ -232,9 +233,9 @@ private function assertInstall(array $options = []): void { $this->assertFileExists($this->path.'/ckeditor.js'); - if (CKEditorInstaller::RELEASE_CUSTOM === ($options['release'] ?? '')) { - $this->assertFileExists($this->path.'/build-config.js'); - $this->assertStringContainsString($options['custom_build_id'], file_get_contents($this->path.'/build-config.js')); + if (CKEditorPredefinedBuild::RELEASE_CUSTOM === ($options['release'] ?? '')) { + // todo +// $this->assertStringContainsString($options['custom_build_id'], file_get_contents($this->path.'/build-config.js')); } else { if (isset($options['release'])) { $this->assertRelease($options['release']); @@ -255,18 +256,18 @@ private function assertInstall(array $options = []): void private function assertRelease(string $release): void { switch ($release) { - case CKEditorInstaller::RELEASE_FULL: + case CKEditorPredefinedBuild::RELEASE_CLASSIC: $this->assertFileExists($this->path.'/plugins/copyformatting'); break; - case CKEditorInstaller::RELEASE_BASIC: + case CKEditorPredefinedBuild::RELEASE_BALLON: $this->assertFileExists($this->path.'/plugins/link'); $this->assertFileDoesNotExist($this->path.'/plugins/image'); break; - case CKEditorInstaller::RELEASE_STANDARD: + case CKEditorPredefinedBuild::RELEASE_DOCUMENT: $this->assertFileExists($this->path.'/plugins/image'); $this->assertFileDoesNotExist($this->path.'/plugins/copyformatting'); diff --git a/tests/Renderer/CKEditorRendererTest.php b/tests/Renderer/CKEditorRendererTest.php index 0203e09c..585d3012 100644 --- a/tests/Renderer/CKEditorRendererTest.php +++ b/tests/Renderer/CKEditorRendererTest.php @@ -346,13 +346,13 @@ public function testRenderWidgetWithCKEditorConstants(): void ); } - public function testRenderWidgetWithoutAutoInline(): void - { - $this->assertSame( - 'CKEDITOR.disableAutoInline = true;'."\n".'CKEDITOR.replace("foo", []);', - $this->renderer->renderWidget('foo', [], ['auto_inline' => false]) - ); - } +// public function testRenderWidgetWithoutAutoInline(): void +// { +// $this->assertSame( +// 'CKEDITOR.disableAutoInline = true;'."\n".'CKEDITOR.replace("foo", []);', +// $this->renderer->renderWidget('foo', [], ['auto_inline' => false]) +// ); +// } public function testRenderWidgetWithInline(): void { diff --git a/tests/Template/AbstractTemplateTest.php b/tests/Template/AbstractTemplateTest.php index 7842e009..3d35eddb 100644 --- a/tests/Template/AbstractTemplateTest.php +++ b/tests/Template/AbstractTemplateTest.php @@ -107,7 +107,7 @@ public function testRenderWithSimpleWidget(): void public function testRenderWithFullWidget(): void { $context = [ - 'auto_inline' => false, +// 'auto_inline' => false, 'inline' => true, 'input_sync' => true, 'config' => ['foo' => 'bar'], @@ -260,7 +260,7 @@ private function getContext(): array 'enable' => true, 'async' => false, 'autoload' => true, - 'auto_inline' => true, +// 'auto_inline' => true, 'inline' => false, 'jquery' => false, 'input_sync' => false, From 9782d76e75b0bfdadecaea6fb9290a7cada61200 Mon Sep 17 00:00:00 2001 From: Florent VIOLLEAU Date: Mon, 12 Feb 2024 12:06:36 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8(feat)=20Migrate=20to=20CKEditor?= =?UTF-8?q?=205:=20rename=20poweredBy=20to=20powered=5Fby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Config/CKEditorConfiguration.php | 2 +- src/DependencyInjection/Configuration.php | 2 +- src/Form/Type/CKEditorType.php | 8 ++++---- src/Resources/views/Form/ckeditor_widget.html.twig | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Config/CKEditorConfiguration.php b/src/Config/CKEditorConfiguration.php index 59f65d6d..8d789be4 100644 --- a/src/Config/CKEditorConfiguration.php +++ b/src/Config/CKEditorConfiguration.php @@ -79,7 +79,7 @@ public function __construct(array $config) $this->enable = $config['enable']; $this->autoload = $config['autoload']; - $this->poweredBy = $config['poweredBy']; + $this->poweredBy = $config['powered_by']; $this->resize = $config['resize']; $this->basePath = $config['base_path']; $this->jsPath = $config['js_path']; diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 9615caf7..73f0ecff 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -36,7 +36,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->children() ->booleanNode('enable')->defaultTrue()->end() ->booleanNode('autoload')->defaultTrue()->end() - ->booleanNode('poweredBy')->defaultTrue()->end() + ->booleanNode('powered_by')->defaultTrue()->end() ->booleanNode('resize')->defaultTrue()->end() ->scalarNode('base_path')->defaultValue('bundles/fosckeditor/')->end() ->scalarNode('js_path')->defaultValue('bundles/fosckeditor/ckeditor.js')->end() diff --git a/src/Form/Type/CKEditorType.php b/src/Form/Type/CKEditorType.php index ab0e6959..9ce13737 100644 --- a/src/Form/Type/CKEditorType.php +++ b/src/Form/Type/CKEditorType.php @@ -44,7 +44,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void } $builder->setAttribute('autoload', $options['autoload']); - $builder->setAttribute('poweredBy', $options['poweredBy']); + $builder->setAttribute('powered_by', $options['powered_by']); $builder->setAttribute('resize', $options['resize']); $builder->setAttribute('base_path', $options['base_path']); $builder->setAttribute('js_path', $options['js_path']); @@ -82,7 +82,7 @@ public function buildView(FormView $view, FormInterface $form, array $options): } $view->vars['autoload'] = $config->getAttribute('autoload'); - $view->vars['poweredBy'] = $config->getAttribute('poweredBy'); + $view->vars['powered_by'] = $config->getAttribute('powered_by'); $view->vars['resize'] = $config->getAttribute('resize'); $view->vars['base_path'] = $config->getAttribute('base_path'); $view->vars['js_path'] = $config->getAttribute('js_path'); @@ -99,7 +99,7 @@ public function configureOptions(OptionsResolver $resolver): void ->setDefaults([ 'enable' => $this->configuration->isEnable(), 'autoload' => $this->configuration->isAutoload(), - 'poweredBy' => $this->configuration->isPoweredBy(), + 'powered_by' => $this->configuration->isPoweredBy(), 'resize' => $this->configuration->isResize(), 'base_path' => $this->configuration->getBasePath(), 'js_path' => $this->configuration->getJsPath(), @@ -111,7 +111,7 @@ public function configureOptions(OptionsResolver $resolver): void ]) ->addAllowedTypes('enable', 'bool') ->addAllowedTypes('autoload', 'bool') - ->addAllowedTypes('poweredBy', 'bool') + ->addAllowedTypes('powered_by', 'bool') ->addAllowedTypes('resize', 'bool') ->addAllowedTypes('config_name', ['string', 'null']) ->addAllowedTypes('base_path', 'string') diff --git a/src/Resources/views/Form/ckeditor_widget.html.twig b/src/Resources/views/Form/ckeditor_widget.html.twig index d3cefd10..a9042888 100644 --- a/src/Resources/views/Form/ckeditor_widget.html.twig +++ b/src/Resources/views/Form/ckeditor_widget.html.twig @@ -17,8 +17,8 @@ {% endif %} - {# {% for plugin_name, plugin in plugins %}#} -{# #} +{# #} {# {% endfor %}#} -