From 03267b637f2e097605c484f1a381d11619a669a0 Mon Sep 17 00:00:00 2001 From: jmsche Date: Thu, 1 Feb 2018 13:52:28 +0100 Subject: [PATCH] Updated for Symfony 4 compatibility --- DependencyInjection/KMSFroalaEditorExtension.php | 2 +- Form/Type/FroalaEditorType.php | 2 +- README.md | 6 +++--- Resources/views/Form/froala_widget.html.twig | 2 +- composer.json | 10 +++++----- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/DependencyInjection/KMSFroalaEditorExtension.php b/DependencyInjection/KMSFroalaEditorExtension.php index d4dadede..93e1175c 100644 --- a/DependencyInjection/KMSFroalaEditorExtension.php +++ b/DependencyInjection/KMSFroalaEditorExtension.php @@ -47,7 +47,7 @@ private function loadResources( ContainerBuilder $p_container ) // ------------------------- DECLARE ---------------------------// $p_container->setParameter( "twig.form.resources", array_merge( array( - "KMSFroalaEditorBundle:Form:froala_widget.html.twig" + "@KMSFroalaEditor/Form/froala_widget.html.twig" ), $p_container->getParameter( "twig.form.resources" ) ) ); } diff --git a/Form/Type/FroalaEditorType.php b/Form/Type/FroalaEditorType.php index 94a623c8..c3ff836d 100644 --- a/Form/Type/FroalaEditorType.php +++ b/Form/Type/FroalaEditorType.php @@ -197,7 +197,7 @@ public function getParent() { // ------------------------- DECLARE ---------------------------// - if( $this->m_version == 3 ) + if( $this->m_version >= 3 ) { return "Symfony\Component\Form\Extension\Core\Type\TextareaType"; } diff --git a/README.md b/README.md index 8188cf6c..eb33b571 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ [![knpbundles.com](http://knpbundles.com/froala/KMSFroalaEditorBundle/badge)](http://knpbundles.com/froala/KMSFroalaEditorBundle) -## Symfony 3 update +## Symfony 3 & 4 update -This bundle is now compatible with Symfony 2 and 3 on the same branch (dev-master). +This bundle is now compatible with Symfony 2, 3 and 4 on the same branch (dev-master). ## Migration to Froala Editor v2 @@ -134,7 +134,7 @@ Just add a froala type in your form: ``` php $builder->add( "yourField", "froala" ); // Symfony 2 -$builder->add( "yourField", FroalaEditorType::class ); // Symfony 3 +$builder->add( "yourField", FroalaEditorType::class ); // Symfony 3 & 4 ``` All configuration items can be overridden: diff --git a/Resources/views/Form/froala_widget.html.twig b/Resources/views/Form/froala_widget.html.twig index 82dc0822..2922ff2a 100644 --- a/Resources/views/Form/froala_widget.html.twig +++ b/Resources/views/Form/froala_widget.html.twig @@ -65,7 +65,7 @@ key : "{{ serialNumber }}", {% endif %} {% for option, value in arrOption %} - {{ option }} : {% include "KMSFroalaEditorBundle:Form:value.html.twig" %} + {{ option }} : {% include "@KMSFroalaEditor/Form/value.html.twig" %} {% endfor %} }) .on( "froalaEditor.image.error", function ( e, editor, error ) { diff --git a/composer.json b/composer.json index 93f8f2a5..9de6ae8d 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "kms/froala-editor-bundle", "type": "symfony-bundle", - "description": "Provides a Froala editor integration for Symfony 2/3.", + "description": "Provides a Froala editor integration for Symfony 2/3/4.", "keywords": [ "froala", "editor", "wysiwyg" ], "license": "MIT", "authors": [ @@ -16,13 +16,13 @@ ], "require": { "php": "^5.3.3|^7.0", - "symfony/framework-bundle": "^2.3|^3.0", - "symfony/form": "^2.3|^3.0", + "symfony/framework-bundle": "^2.3|^3.0|^4.0", + "symfony/form": "^2.3|^3.0|^4.0", "twig/twig": "^1.1|^2.0" }, "require-dev": { - "symfony/twig-bundle": "^2.3|^3.0", - "symfony/yaml": "^2.3|^3.0" + "symfony/twig-bundle": "^2.3|^3.0|^4.0", + "symfony/yaml": "^2.3|^3.0|^4.0" }, "autoload": { "psr-4": { "KMS\\FroalaEditorBundle\\": "" }