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 758ed17
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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 @@ -43,7 +43,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:)`']),
],
]),
new Assert\NotBlank([]),
Expand All @@ -57,7 +57,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 +69,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 758ed17

Please sign in to comment.