diff --git a/src/Form/Type/LinkType.php b/src/Form/Type/LinkType.php new file mode 100644 index 00000000..e1b05ff3 --- /dev/null +++ b/src/Form/Type/LinkType.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace MonsieurBiz\SyliusRichEditorPlugin\Form\Type; + +use Symfony\Component\Form\Extension\Core\Type\TextType; + +final class LinkType extends TextType +{ + /** + * Custom type to identify TextType which need to be considered as a Link. + */ +} diff --git a/src/Form/Type/UiElement/ButtonLinkType.php b/src/Form/Type/UiElement/ButtonLinkType.php index 47a474e9..e87ae114 100644 --- a/src/Form/Type/UiElement/ButtonLinkType.php +++ b/src/Form/Type/UiElement/ButtonLinkType.php @@ -15,9 +15,9 @@ use MonsieurBiz\SyliusRichEditorPlugin\Form\Type\AlignmentType; use MonsieurBiz\SyliusRichEditorPlugin\Form\Type\LevelType; +use MonsieurBiz\SyliusRichEditorPlugin\Form\Type\LinkType; use MonsieurBiz\SyliusRichEditorPlugin\Form\Type\LinkTypeType; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType as FormTextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Constraints as Assert; @@ -69,7 +69,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'label' => 'monsieurbiz_richeditor_plugin.ui_element.monsieurbiz.button.field.label', 'constraints' => $constraintsLabel, ]) - ->add('link', TextType::class, [ + ->add('link', LinkType::class, [ 'required' => $required, 'label' => 'monsieurbiz_richeditor_plugin.ui_element.monsieurbiz.button.field.link', 'constraints' => $constraintsLink, diff --git a/src/Form/Type/UiElement/ImageType.php b/src/Form/Type/UiElement/ImageType.php index c6d7b52b..22eda270 100644 --- a/src/Form/Type/UiElement/ImageType.php +++ b/src/Form/Type/UiElement/ImageType.php @@ -16,12 +16,12 @@ use MonsieurBiz\SyliusMediaManagerPlugin\Form\Type\ImageType as MediaManagerImageType; use MonsieurBiz\SyliusRichEditorPlugin\Form\Constraints\RichEditorConstraints; use MonsieurBiz\SyliusRichEditorPlugin\Form\Type\AlignmentType; +use MonsieurBiz\SyliusRichEditorPlugin\Form\Type\LinkType; use MonsieurBiz\SyliusRichEditorPlugin\Form\Type\LinkTypeType; use MonsieurBiz\SyliusRichEditorPlugin\MonsieurBizSyliusRichEditorPlugin; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\Extension\Core\Type\TextType as FormTextType; -use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; @@ -58,7 +58,7 @@ public function addFields(FormBuilderInterface $builder, array $options): void 'required' => false, 'label' => 'monsieurbiz_richeditor_plugin.ui_element.monsieurbiz.image.field.title', ]) - ->add('link', UrlType::class, [ + ->add('link', LinkType::class, [ 'required' => false, 'label' => 'monsieurbiz_richeditor_plugin.ui_element.monsieurbiz.image.field.link', 'constraints' => [