Skip to content

Commit

Permalink
Link is TextType because UrlType add https
Browse files Browse the repository at this point in the history
  • Loading branch information
maximehuran committed Sep 6, 2024
1 parent 53b197d commit eace97f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Form/Type/UiElement/ButtonLinkType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
use MonsieurBiz\SyliusRichEditorPlugin\Form\Type\LevelType;
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\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -42,8 +42,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'includeInternalMessages' => false,
'message' => 'monsieurbiz_richeditor_plugin.not_valid_url',
'constraints' => [
new Assert\Url(['protocols' => ['http', 'https'], 'relativeProtocol' => true]),
new Assert\Regex(['pattern' => '`^(#|/.*)$`']),
new Assert\Regex(['pattern' => '`^(#|/|tel:|mailto:)`']),
],
]),
new Assert\NotBlank([]),
Expand All @@ -57,7 +56,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'message' => 'monsieurbiz_richeditor_plugin.not_valid_url',
'constraints' => [
new Assert\Url(['protocols' => ['http', 'https'], 'relativeProtocol' => true]),
new Assert\Regex(['pattern' => '`^(#|/.*)$`']),
new Assert\Regex(['pattern' => '`^(#|/|tel:|mailto:)`']),
],
]),
];
Expand All @@ -69,7 +68,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
'label' => 'monsieurbiz_richeditor_plugin.ui_element.monsieurbiz.button.field.label',
'constraints' => $constraintsLabel,
])
->add('link', UrlType::class, [
->add('link', TextType::class, [
'required' => $required,
'label' => 'monsieurbiz_richeditor_plugin.ui_element.monsieurbiz.button.field.link',
'constraints' => $constraintsLink,
Expand Down

0 comments on commit eace97f

Please sign in to comment.