refactor(naming): normalise the Smart Links domain to the bundle's canonical names (0.18.1)
One bundle, two domains (Marketing Programs and Smart Links), one naming scheme.\nNothing in the database changed (no tables, columns, URLs or stored data);\nthe runtime was rebuilt and verified live.\n\n- Route names mautic_smartlinks_* -> mt3s_smartlinks_* (paths unchanged);\n the menu ids follow\n- Model service aliases collapsed to one canonical alias per model:\n mautic.mt3smarketingprogram.model.<entity> (core's mautic.<x>.model.<x>\n pattern), so getModel('mt3smarketingprogram.smart_link'); the dead\n mt3s.* and mautic.mt3smp.*-era aliases are gone\n- Translation keys mautic.smartlinks.* -> mt3s.smart_links.*\n (mautic.config.tab.smartlinksconfig stays: core derives it)\n- Settings parameters smartlinks_utm_config/smartlinks_config ->\n mt3s_smart_links_utm_config/mt3s_smart_links_config, with both legacy\n keys (smartlinks_* of the standalone bundle, utm_manager_* of the\n UtmManagerBundle era) still readable until the settings are saved again\n- JS loader prefixes smartlinksSmartLink/smartlinksUtmTaxonomy ->\n mt3sMpSmartLink/mt3sMpUtmTaxonomy (the mt3sMp* family of the program\n domain)\n- Integration/Support/ConfigSupport -> SmartlinksConfigSupport; integration\n display names aligned ('MT3S Marketing Program' / 'Smart Links'); the\n dead mautic.plugin.smartlinks.name catalog keys removed\n- phpunit suite renamed UtmManagerBundle -> MT3SMarketingProgramBundle;\n version 0.18.1\n\nVerified: full php -l, 90/90 unit tests (phpunit 11.5 phar), cache clear +\nwarm + assets regenerate + plugins reload (as www-data), live: both lists\nand forms (mauticContent mt3sMpSmartLink/mt3sMpUtmTaxonomy), both config\ntabs, the menu labels, the program pages (regression), the public /l/y32b\nredirect through the legacy utm_manager_* settings (302 with the taxonomy's\nUTM values, wrong host and unknown slug 404), all ini catalogs parse, zero\nnew log errors.
This commit is contained in:
1 parent
dce849610c
commit
9d81d6c815
53 files changed
+777
-751
No files matched your search
@@ -11,7 +11,7 @@ use Symfony\Component\Form\DataTransformerInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* Converts between the stored `smartlinks_utm_config` array (parameters keyed by their key)
|
||||
* Converts between the stored `mt3s_smart_links_utm_config` array (parameters keyed by their key)
|
||||
* and the form structure (catalog parameters + a collection of custom parameters).
|
||||
*
|
||||
* @implements DataTransformerInterface<mixed, array<string, mixed>>
|
||||
|
||||
+22
-22
@@ -84,22 +84,22 @@ final class SmartLinkType extends AbstractType
|
||||
// on save, exactly like the live preview does. The constraints only guard the raw input;
|
||||
// spaces are allowed here because they are turned into the separator on save.
|
||||
$builder->add('slug', TextType::class, [
|
||||
'label' => 'mautic.smartlinks.smart_links.slug',
|
||||
'label' => 'mt3s.smart_links.smart_links.slug',
|
||||
'required' => true,
|
||||
'disabled' => $isSaved,
|
||||
'attr' => [
|
||||
'class' => 'form-control smart-link-slug',
|
||||
'maxlength' => SmartLink::SLUG_MAX_LENGTH,
|
||||
'tooltip' => 'mautic.smartlinks.smart_links.slug.tooltip',
|
||||
'tooltip' => 'mt3s.smart_links.smart_links.slug.tooltip',
|
||||
// Live preview of the short link: the JS fills the span next to the field.
|
||||
'data-preview' => 'smart-link-preview',
|
||||
],
|
||||
'constraints' => $isSaved ? [] : [
|
||||
new NotBlank(message: 'mautic.smartlinks.smart_links.error.slug_required'),
|
||||
new Length(max: SmartLink::SLUG_MAX_LENGTH, maxMessage: 'mautic.smartlinks.smart_links.error.slug_length'),
|
||||
new NotBlank(message: 'mt3s.smart_links.smart_links.error.slug_required'),
|
||||
new Length(max: SmartLink::SLUG_MAX_LENGTH, maxMessage: 'mt3s.smart_links.smart_links.error.slug_length'),
|
||||
new Regex(
|
||||
pattern: '/^[\p{L}0-9\-_. ]*$/u',
|
||||
message: 'mautic.smartlinks.smart_links.error.slug_characters'
|
||||
message: 'mt3s.smart_links.smart_links.error.slug_characters'
|
||||
),
|
||||
new Callback(callback: $this->validateSlug(...)),
|
||||
],
|
||||
@@ -107,40 +107,40 @@ final class SmartLinkType extends AbstractType
|
||||
|
||||
// -- Redirect ------------------------------------------------------------
|
||||
$builder->add('redirectType', EnumType::class, [
|
||||
'label' => 'mautic.smartlinks.smart_links.redirect_type',
|
||||
'label' => 'mt3s.smart_links.smart_links.redirect_type',
|
||||
'class' => SmartLinkRedirectType::class,
|
||||
'choice_label' => fn (SmartLinkRedirectType $type): string => $this->translator->trans($type->getLabelKey()),
|
||||
'attr' => ['class' => 'form-control smart-link-redirect-type'],
|
||||
]);
|
||||
|
||||
$builder->add('redirectCode', EnumType::class, [
|
||||
'label' => 'mautic.smartlinks.smart_links.redirect_code',
|
||||
'label' => 'mt3s.smart_links.smart_links.redirect_code',
|
||||
'class' => SmartLinkRedirectCode::class,
|
||||
'choice_label' => fn (SmartLinkRedirectCode $code): string => $code->getTranslatedLabel($this->translator),
|
||||
'attr' => ['class' => 'form-control smart-link-redirect-code'],
|
||||
]);
|
||||
|
||||
$builder->add('destinationUrl', UrlType::class, [
|
||||
'label' => 'mautic.smartlinks.smart_links.destination_url',
|
||||
'label' => 'mt3s.smart_links.smart_links.destination_url',
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'class' => 'form-control smart-link-destination',
|
||||
'tooltip' => 'mautic.smartlinks.smart_links.destination_url.tooltip',
|
||||
'tooltip' => 'mt3s.smart_links.smart_links.destination_url.tooltip',
|
||||
],
|
||||
'constraints' => [new Callback(callback: $this->validateDestination(...))],
|
||||
]);
|
||||
|
||||
// -- Mautic destination: a landing page or a standalone form -------------------------
|
||||
$builder->add('destination', ChoiceType::class, [
|
||||
'label' => 'mautic.smartlinks.smart_links.destination',
|
||||
'label' => 'mt3s.smart_links.smart_links.destination',
|
||||
'required' => false,
|
||||
'mapped' => false,
|
||||
'attr' => [
|
||||
'class' => 'form-control smart-link-mautic-destination',
|
||||
'tooltip' => 'mautic.smartlinks.smart_links.destination.tooltip',
|
||||
'tooltip' => 'mt3s.smart_links.smart_links.destination.tooltip',
|
||||
],
|
||||
'choices' => $this->buildMauticDestinationChoices($smartLink),
|
||||
'placeholder' => 'mautic.smartlinks.form.choose',
|
||||
'placeholder' => 'mt3s.smart_links.form.choose',
|
||||
'data' => $this->currentMauticDestination($smartLink),
|
||||
]);
|
||||
|
||||
@@ -150,16 +150,16 @@ final class SmartLinkType extends AbstractType
|
||||
// taxonomy that is no longer published stays selectable, so an old link is still
|
||||
// editable (a new one can always be chosen instead).
|
||||
$builder->add('taxonomy', ChoiceType::class, [
|
||||
'label' => 'mautic.smartlinks.smart_links.taxonomy',
|
||||
'label' => 'mt3s.smart_links.smart_links.taxonomy',
|
||||
'required' => true,
|
||||
'placeholder' => 'mautic.smartlinks.form.choose',
|
||||
'placeholder' => 'mt3s.smart_links.form.choose',
|
||||
'choices' => $this->buildTaxonomyChoices($smartLink),
|
||||
'choice_value' => fn (?UtmTaxonomy $taxonomy): string => (string) ($taxonomy?->getId() ?? ''),
|
||||
'attr' => [
|
||||
'class' => 'form-control smart-link-taxonomy',
|
||||
'tooltip' => 'mautic.smartlinks.smart_links.taxonomy.tooltip',
|
||||
'tooltip' => 'mt3s.smart_links.smart_links.taxonomy.tooltip',
|
||||
],
|
||||
'constraints' => [new NotBlank(message: 'mautic.smartlinks.smart_links.error.taxonomy_required')],
|
||||
'constraints' => [new NotBlank(message: 'mt3s.smart_links.smart_links.error.taxonomy_required')],
|
||||
]);
|
||||
|
||||
// -- UTM parameters ------------------------------------------------------------
|
||||
@@ -322,7 +322,7 @@ final class SmartLinkType extends AbstractType
|
||||
foreach ($this->getFormTaxonomies($smartLink) as $taxonomy) {
|
||||
$label = (string) $taxonomy->getName();
|
||||
if (!$taxonomy->isPublished()) {
|
||||
$label = $this->translator->trans('mautic.smartlinks.taxonomies.unpublished_choice', ['%name%' => $label]);
|
||||
$label = $this->translator->trans('mt3s.smart_links.taxonomies.unpublished_choice', ['%name%' => $label]);
|
||||
}
|
||||
|
||||
$choices[$label] = $taxonomy;
|
||||
@@ -348,7 +348,7 @@ final class SmartLinkType extends AbstractType
|
||||
$stored = (string) ($smartLink->getUtmParameters()[$key] ?? '');
|
||||
if ('' !== $stored && !\in_array($stored, $choices, true)) {
|
||||
$choices = [
|
||||
$this->translator->trans('mautic.smartlinks.form.legacy_choice', ['%value%' => $stored]) => $stored,
|
||||
$this->translator->trans('mt3s.smart_links.form.legacy_choice', ['%value%' => $stored]) => $stored,
|
||||
] + $choices;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ final class SmartLinkType extends AbstractType
|
||||
'label' => (string) ($parameter['label'] ?? $key),
|
||||
'required' => false,
|
||||
'choices' => $choices,
|
||||
'placeholder' => 'mautic.smartlinks.form.choose',
|
||||
'placeholder' => 'mt3s.smart_links.form.choose',
|
||||
'attr' => ['class' => 'form-control smart-link-utm'],
|
||||
];
|
||||
}
|
||||
@@ -511,14 +511,14 @@ final class SmartLinkType extends AbstractType
|
||||
$pages = $this->getPageRepository()->findBy(['isPublished' => true], ['title' => 'ASC']);
|
||||
foreach ($pages as $page) {
|
||||
$value = 'page:'.$page->getId();
|
||||
$choices['mautic.smartlinks.smart_links.destination.pages'][$page->getTitle()] = $value;
|
||||
$choices['mt3s.smart_links.smart_links.destination.pages'][$page->getTitle()] = $value;
|
||||
$values[] = $value;
|
||||
}
|
||||
|
||||
$forms = $this->getFormRepository()->findBy(['isPublished' => true], ['name' => 'ASC']);
|
||||
foreach ($forms as $form) {
|
||||
$value = 'form:'.$form->getId();
|
||||
$choices['mautic.smartlinks.smart_links.destination.forms'][$form->getName()] = $value;
|
||||
$choices['mt3s.smart_links.smart_links.destination.forms'][$form->getName()] = $value;
|
||||
$values[] = $value;
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ final class SmartLinkType extends AbstractType
|
||||
$current = $this->currentMauticDestination($smartLink);
|
||||
if (null !== $current && !in_array($current, $values, true)) {
|
||||
$label = $smartLink->getPage()?->getTitle() ?? $smartLink->getForm()?->getName() ?? '';
|
||||
$choices['mautic.smartlinks.smart_links.destination.unpublished'][$label] = $current;
|
||||
$choices['mt3s.smart_links.smart_links.destination.unpublished'][$label] = $current;
|
||||
}
|
||||
|
||||
return $choices;
|
||||
|
||||
@@ -20,7 +20,10 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
final class SmartLinksConfigType extends AbstractType
|
||||
{
|
||||
/** Stored in local.php under this key (an array: short_link_domain => domain). */
|
||||
public const CONFIG_PARAMETER = 'smartlinks_config';
|
||||
public const CONFIG_PARAMETER = 'mt3s_smart_links_config';
|
||||
|
||||
/** Key of the standalone SmartlinksBundle era (0.1.0–0.18.0); still honored until the domain is saved again. */
|
||||
public const LEGACY_SMARTLINKS_PARAMETER = 'smartlinks_config';
|
||||
|
||||
/** Key of the UtmManagerBundle era (< 0.5.0); still honored until the domain is saved again. */
|
||||
public const LEGACY_CONFIG_PARAMETER = 'utm_manager_smart_links';
|
||||
@@ -33,11 +36,11 @@ final class SmartLinksConfigType extends AbstractType
|
||||
$builder->add(self::CONFIG_PARAMETER, FormType::class, ['label' => false]);
|
||||
|
||||
$builder->get(self::CONFIG_PARAMETER)->add('short_link_domain', TextType::class, [
|
||||
'label' => 'mautic.smartlinks.settings.short_link_domain',
|
||||
'label' => 'mt3s.smart_links.settings.short_link_domain',
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'class' => 'form-control',
|
||||
'tooltip' => 'mautic.smartlinks.settings.short_link_domain.tooltip',
|
||||
'tooltip' => 'mt3s.smart_links.settings.short_link_domain.tooltip',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* The `smartlinks_utm_config` parameter: general settings, catalog parameters and custom parameters.
|
||||
* The `mt3s_smart_links_utm_config` parameter: general settings, catalog parameters and custom parameters.
|
||||
*
|
||||
* @extends AbstractType<array<string, mixed>>
|
||||
*/
|
||||
@@ -31,23 +31,23 @@ final class SmartlinksSettingsType extends AbstractType
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->add('enforce_lowercase', YesNoButtonGroupType::class, [
|
||||
'label' => 'mautic.smartlinks.config.enforce_lowercase',
|
||||
'attr' => ['tooltip' => 'mautic.smartlinks.config.enforce_lowercase.tooltip'],
|
||||
'label' => 'mt3s.smart_links.config.enforce_lowercase',
|
||||
'attr' => ['tooltip' => 'mt3s.smart_links.config.enforce_lowercase.tooltip'],
|
||||
]);
|
||||
|
||||
$builder->add('separator_replacement', ChoiceType::class, [
|
||||
'label' => 'mautic.smartlinks.config.separator_replacement',
|
||||
'label' => 'mt3s.smart_links.config.separator_replacement',
|
||||
'choices' => [
|
||||
'mautic.smartlinks.config.separator.hyphen' => '-',
|
||||
'mautic.smartlinks.config.separator.underscore' => '_',
|
||||
'mautic.smartlinks.config.separator.dot' => '.',
|
||||
'mt3s.smart_links.config.separator.hyphen' => '-',
|
||||
'mt3s.smart_links.config.separator.underscore' => '_',
|
||||
'mt3s.smart_links.config.separator.dot' => '.',
|
||||
],
|
||||
'placeholder' => false,
|
||||
'attr' => [
|
||||
'class' => 'form-control',
|
||||
'tooltip' => 'mautic.smartlinks.config.separator_replacement.tooltip',
|
||||
'tooltip' => 'mt3s.smart_links.config.separator_replacement.tooltip',
|
||||
],
|
||||
'invalid_message' => 'mautic.smartlinks.config.error.separator_invalid',
|
||||
'invalid_message' => 'mt3s.smart_links.config.error.separator_invalid',
|
||||
]);
|
||||
|
||||
$parameters = $builder->create('parameters', FormType::class, ['label' => false]);
|
||||
@@ -85,6 +85,6 @@ final class SmartlinksSettingsType extends AbstractType
|
||||
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'smartlinks_utm_settings';
|
||||
return 'mt3s_smart_links_utm_settings';
|
||||
}
|
||||
}
|
||||
@@ -48,9 +48,9 @@ final class UtmParameterType extends AbstractType
|
||||
public static function labelConstraints(): array
|
||||
{
|
||||
return [
|
||||
new NotBlank(message: 'mautic.smartlinks.config.error.label_required'),
|
||||
new Length(max: UtmSettingsValidator::MAX_LENGTH, maxMessage: 'mautic.smartlinks.config.error.label_length'),
|
||||
new Regex(pattern: '/%/', match: false, message: 'mautic.smartlinks.config.error.label_invalid'),
|
||||
new NotBlank(message: 'mt3s.smart_links.config.error.label_required'),
|
||||
new Length(max: UtmSettingsValidator::MAX_LENGTH, maxMessage: 'mt3s.smart_links.config.error.label_length'),
|
||||
new Regex(pattern: '/%/', match: false, message: 'mt3s.smart_links.config.error.label_invalid'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -62,44 +62,44 @@ final class UtmParameterType extends AbstractType
|
||||
|
||||
if (null === $definition) {
|
||||
$builder->add('key', TextType::class, [
|
||||
'label' => 'mautic.smartlinks.config.parameter.key',
|
||||
'label' => 'mt3s.smart_links.config.parameter.key',
|
||||
'attr' => [
|
||||
'class' => 'form-control utm-custom-key',
|
||||
'tooltip' => 'mautic.smartlinks.config.parameter.key.tooltip',
|
||||
'tooltip' => 'mt3s.smart_links.config.parameter.key.tooltip',
|
||||
'maxlength' => 41,
|
||||
],
|
||||
'constraints' => [
|
||||
new NotBlank(message: 'mautic.smartlinks.config.error.key_required'),
|
||||
new NotBlank(message: 'mt3s.smart_links.config.error.key_required'),
|
||||
new Callback(callback: $this->validateCustomKey(...)),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
$builder->add('enabled', YesNoButtonGroupType::class, [
|
||||
'label' => 'mautic.smartlinks.config.parameter.enabled',
|
||||
'label' => 'mt3s.smart_links.config.parameter.enabled',
|
||||
]);
|
||||
|
||||
$builder->add('label', TextType::class, [
|
||||
'label' => 'mautic.smartlinks.config.parameter.label',
|
||||
'label' => 'mt3s.smart_links.config.parameter.label',
|
||||
'attr' => ['class' => 'form-control', 'maxlength' => UtmSettingsValidator::MAX_LENGTH],
|
||||
'constraints' => self::labelConstraints(),
|
||||
]);
|
||||
|
||||
$modeAttr = ['class' => 'form-control utm-mode'];
|
||||
if ($definition?->autoGenerated) {
|
||||
$modeAttr['tooltip'] = 'mautic.smartlinks.config.auto_generated.tooltip';
|
||||
$modeAttr['tooltip'] = 'mt3s.smart_links.config.auto_generated.tooltip';
|
||||
}
|
||||
|
||||
$builder->add('mode', ChoiceType::class, [
|
||||
'label' => 'mautic.smartlinks.config.parameter.mode',
|
||||
'label' => 'mt3s.smart_links.config.parameter.mode',
|
||||
'choices' => array_combine(
|
||||
array_map(fn (string $mode): string => 'mautic.smartlinks.config.mode.'.$mode, $allowedModes),
|
||||
array_map(fn (string $mode): string => 'mt3s.smart_links.config.mode.'.$mode, $allowedModes),
|
||||
$allowedModes
|
||||
),
|
||||
'placeholder' => false,
|
||||
'attr' => $modeAttr,
|
||||
'invalid_message' => 'mautic.smartlinks.config.error.mode_invalid',
|
||||
'constraints' => [new NotBlank(message: 'mautic.smartlinks.config.error.mode_invalid')],
|
||||
'invalid_message' => 'mt3s.smart_links.config.error.mode_invalid',
|
||||
'constraints' => [new NotBlank(message: 'mt3s.smart_links.config.error.mode_invalid')],
|
||||
]);
|
||||
|
||||
// Values only exist in dropdown mode: drop anything submitted for other modes (or for parameters
|
||||
|
||||
@@ -49,26 +49,26 @@ final class UtmTaxonomyType extends AbstractType
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->add('name', TextType::class, [
|
||||
'label' => 'mautic.smartlinks.taxonomies.name',
|
||||
'label' => 'mt3s.smart_links.taxonomies.name',
|
||||
'required' => true,
|
||||
'attr' => [
|
||||
'class' => 'form-control',
|
||||
'maxlength' => UtmTaxonomy::NAME_MAX_LENGTH,
|
||||
'tooltip' => 'mautic.smartlinks.taxonomies.name.tooltip',
|
||||
'tooltip' => 'mt3s.smart_links.taxonomies.name.tooltip',
|
||||
],
|
||||
'constraints' => [
|
||||
new NotBlank(message: 'mautic.smartlinks.taxonomies.error.name_required'),
|
||||
new Length(max: UtmTaxonomy::NAME_MAX_LENGTH, maxMessage: 'mautic.smartlinks.taxonomies.error.name_length'),
|
||||
new NotBlank(message: 'mt3s.smart_links.taxonomies.error.name_required'),
|
||||
new Length(max: UtmTaxonomy::NAME_MAX_LENGTH, maxMessage: 'mt3s.smart_links.taxonomies.error.name_length'),
|
||||
new Callback(callback: $this->validateName(...)),
|
||||
],
|
||||
]);
|
||||
|
||||
$builder->add('description', TextareaType::class, [
|
||||
'label' => 'mautic.smartlinks.taxonomies.description',
|
||||
'label' => 'mt3s.smart_links.taxonomies.description',
|
||||
'required' => false,
|
||||
'attr' => [
|
||||
'class' => 'form-control',
|
||||
'tooltip' => 'mautic.smartlinks.taxonomies.description.tooltip',
|
||||
'tooltip' => 'mt3s.smart_links.taxonomies.description.tooltip',
|
||||
'rows' => 3,
|
||||
],
|
||||
]);
|
||||
@@ -114,7 +114,7 @@ final class UtmTaxonomyType extends AbstractType
|
||||
if (isset($dropdowns[$key])) {
|
||||
$attr = ['class' => 'utm-taxonomy-values'];
|
||||
if ([] === $dropdowns[$key]) {
|
||||
$attr['tooltip'] = 'mautic.smartlinks.taxonomies.no_values.tooltip';
|
||||
$attr['tooltip'] = 'mt3s.smart_links.taxonomies.no_values.tooltip';
|
||||
}
|
||||
|
||||
$builder->get('parameters')->add($key, ChoiceType::class, [
|
||||
@@ -136,8 +136,8 @@ final class UtmTaxonomyType extends AbstractType
|
||||
'attr' => [
|
||||
'class' => 'form-control utm-taxonomy-free-values',
|
||||
'rows' => 2,
|
||||
'tooltip' => 'mautic.smartlinks.taxonomies.free_values.tooltip',
|
||||
'placeholder' => 'mautic.smartlinks.taxonomies.free_values.placeholder',
|
||||
'tooltip' => 'mt3s.smart_links.taxonomies.free_values.tooltip',
|
||||
'placeholder' => 'mt3s.smart_links.taxonomies.free_values.placeholder',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -24,31 +24,31 @@ final class UtmValueType extends AbstractType
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->add('value', TextType::class, [
|
||||
'label' => 'mautic.smartlinks.config.values.value',
|
||||
'label' => 'mt3s.smart_links.config.values.value',
|
||||
'attr' => [
|
||||
'class' => 'form-control utm-value-input',
|
||||
'placeholder' => 'mautic.smartlinks.config.values.value',
|
||||
'placeholder' => 'mt3s.smart_links.config.values.value',
|
||||
'maxlength' => UtmSettingsValidator::MAX_LENGTH,
|
||||
],
|
||||
'constraints' => [
|
||||
new NotBlank(message: 'mautic.smartlinks.config.error.value_required'),
|
||||
new Length(max: UtmSettingsValidator::MAX_LENGTH, maxMessage: 'mautic.smartlinks.config.error.value_length'),
|
||||
new Regex(pattern: UtmSettingsValidator::VALUE_PATTERN, message: 'mautic.smartlinks.config.error.value_invalid'),
|
||||
new NotBlank(message: 'mt3s.smart_links.config.error.value_required'),
|
||||
new Length(max: UtmSettingsValidator::MAX_LENGTH, maxMessage: 'mt3s.smart_links.config.error.value_length'),
|
||||
new Regex(pattern: UtmSettingsValidator::VALUE_PATTERN, message: 'mt3s.smart_links.config.error.value_invalid'),
|
||||
],
|
||||
]);
|
||||
|
||||
$builder->add('label', TextType::class, [
|
||||
'label' => 'mautic.smartlinks.config.values.label',
|
||||
'label' => 'mt3s.smart_links.config.values.label',
|
||||
'attr' => [
|
||||
'class' => 'form-control utm-label-input',
|
||||
'placeholder' => 'mautic.smartlinks.config.values.label',
|
||||
'placeholder' => 'mt3s.smart_links.config.values.label',
|
||||
'maxlength' => UtmSettingsValidator::MAX_LENGTH,
|
||||
],
|
||||
'constraints' => UtmParameterType::labelConstraints(),
|
||||
]);
|
||||
|
||||
$builder->add('is_default', CheckboxType::class, [
|
||||
'label' => 'mautic.smartlinks.config.values.default',
|
||||
'label' => 'mt3s.smart_links.config.values.default',
|
||||
'required' => false,
|
||||
'attr' => ['class' => 'utm-value-default'],
|
||||
]);
|
||||
|
||||
@@ -144,11 +144,11 @@ final class UtmFieldsApplicator
|
||||
$storedValue = null === $stored ? '' : (string) $stored;
|
||||
if ('' !== $storedValue && !array_key_exists($storedValue, $labels)) {
|
||||
// Legacy value: kept as the last choice so it displays and re-saves without data loss.
|
||||
$labels[$storedValue] = $this->translator->trans('mautic.smartlinks.form.legacy_choice', ['%value%' => $storedValue]);
|
||||
$options['help'] = 'mautic.smartlinks.form.legacy_warning';
|
||||
$labels[$storedValue] = $this->translator->trans('mt3s.smart_links.form.legacy_choice', ['%value%' => $storedValue]);
|
||||
$options['help'] = 'mt3s.smart_links.form.legacy_warning';
|
||||
$options['help_attr'] = ['class' => 'text-warning'];
|
||||
} elseif ([] === $labels) {
|
||||
$options['help'] = 'mautic.smartlinks.form.no_values';
|
||||
$options['help'] = 'mt3s.smart_links.form.no_values';
|
||||
$options['help_attr'] = ['class' => 'text-warning'];
|
||||
}
|
||||
|
||||
@@ -157,12 +157,12 @@ final class UtmFieldsApplicator
|
||||
'choice_label' => static fn (string $value): string => $labels[$value],
|
||||
// Configured labels are shown as typed. The placeholder is translated here for the same reason.
|
||||
'choice_translation_domain' => false,
|
||||
'placeholder' => $this->translator->trans('mautic.smartlinks.form.choose'),
|
||||
'placeholder' => $this->translator->trans('mt3s.smart_links.form.choose'),
|
||||
'required' => false,
|
||||
'multiple' => false,
|
||||
'expanded' => false,
|
||||
'attr' => ['class' => 'form-control'],
|
||||
'invalid_message' => 'mautic.smartlinks.form.error.not_in_taxonomy',
|
||||
'invalid_message' => 'mt3s.smart_links.form.error.not_in_taxonomy',
|
||||
];
|
||||
|
||||
if (null !== $label) {
|
||||
|
||||
@@ -18,15 +18,15 @@ use MauticPlugin\MT3SMarketingProgramBundle\Model\SmartLinkModel;
|
||||
*/
|
||||
final class SmartLinkValidator
|
||||
{
|
||||
public const ERROR_SLUG_TAKEN = 'mautic.smartlinks.smart_links.error.slug_taken';
|
||||
public const ERROR_SLUG_REQUIRED = 'mautic.smartlinks.smart_links.error.slug_required';
|
||||
public const ERROR_SLUG_LENGTH = 'mautic.smartlinks.smart_links.error.slug_length';
|
||||
public const ERROR_DESTINATION_REQUIRED = 'mautic.smartlinks.smart_links.error.destination_required';
|
||||
public const ERROR_DESTINATION_REQUIRED_MAUTIC = 'mautic.smartlinks.smart_links.error.destination_required_mautic';
|
||||
public const ERROR_DESTINATION_INVALID = 'mautic.smartlinks.smart_links.error.destination_invalid';
|
||||
public const ERROR_UTM_VALUE_INVALID = 'mautic.smartlinks.smart_links.error.utm_value_invalid';
|
||||
public const ERROR_UTM_VALUE_NOT_ALLOWED = 'mautic.smartlinks.smart_links.error.utm_value_not_allowed';
|
||||
public const ERROR_TAXONOMY_PARAMETER_UNKNOWN = 'mautic.smartlinks.smart_links.error.taxonomy_parameter_unknown';
|
||||
public const ERROR_SLUG_TAKEN = 'mt3s.smart_links.smart_links.error.slug_taken';
|
||||
public const ERROR_SLUG_REQUIRED = 'mt3s.smart_links.smart_links.error.slug_required';
|
||||
public const ERROR_SLUG_LENGTH = 'mt3s.smart_links.smart_links.error.slug_length';
|
||||
public const ERROR_DESTINATION_REQUIRED = 'mt3s.smart_links.smart_links.error.destination_required';
|
||||
public const ERROR_DESTINATION_REQUIRED_MAUTIC = 'mt3s.smart_links.smart_links.error.destination_required_mautic';
|
||||
public const ERROR_DESTINATION_INVALID = 'mt3s.smart_links.smart_links.error.destination_invalid';
|
||||
public const ERROR_UTM_VALUE_INVALID = 'mt3s.smart_links.smart_links.error.utm_value_invalid';
|
||||
public const ERROR_UTM_VALUE_NOT_ALLOWED = 'mt3s.smart_links.smart_links.error.utm_value_not_allowed';
|
||||
public const ERROR_TAXONOMY_PARAMETER_UNKNOWN = 'mt3s.smart_links.smart_links.error.taxonomy_parameter_unknown';
|
||||
|
||||
public function __construct(
|
||||
private readonly SmartLinkModel $smartLinkModel,
|
||||
|
||||
@@ -18,12 +18,12 @@ final class UtmSettingsValidator
|
||||
|
||||
public const MAX_LENGTH = 100;
|
||||
|
||||
public const ERROR_KEY_INVALID = 'mautic.smartlinks.config.error.key_invalid';
|
||||
public const ERROR_KEY_RESERVED = 'mautic.smartlinks.config.error.key_reserved';
|
||||
public const ERROR_KEY_DUPLICATE = 'mautic.smartlinks.config.error.key_duplicate';
|
||||
public const ERROR_VALUES_REQUIRED = 'mautic.smartlinks.config.error.values_required';
|
||||
public const ERROR_VALUE_DUPLICATE = 'mautic.smartlinks.config.error.value_duplicate';
|
||||
public const ERROR_DEFAULT_MULTIPLE = 'mautic.smartlinks.config.error.default_multiple';
|
||||
public const ERROR_KEY_INVALID = 'mt3s.smart_links.config.error.key_invalid';
|
||||
public const ERROR_KEY_RESERVED = 'mt3s.smart_links.config.error.key_reserved';
|
||||
public const ERROR_KEY_DUPLICATE = 'mt3s.smart_links.config.error.key_duplicate';
|
||||
public const ERROR_VALUES_REQUIRED = 'mt3s.smart_links.config.error.values_required';
|
||||
public const ERROR_VALUE_DUPLICATE = 'mt3s.smart_links.config.error.value_duplicate';
|
||||
public const ERROR_DEFAULT_MULTIPLE = 'mt3s.smart_links.config.error.default_multiple';
|
||||
|
||||
public function __construct(
|
||||
private readonly UtmParameterCatalog $catalog,
|
||||
|
||||
@@ -12,10 +12,10 @@ use MauticPlugin\MT3SMarketingProgramBundle\Model\UtmTaxonomyModel;
|
||||
*/
|
||||
final class UtmTaxonomyValidator
|
||||
{
|
||||
public const ERROR_NAME_TAKEN = 'mautic.smartlinks.taxonomies.error.name_taken';
|
||||
public const ERROR_NAME_CHARACTERS = 'mautic.smartlinks.taxonomies.error.name_characters';
|
||||
public const ERROR_VALUE_INVALID = 'mautic.smartlinks.taxonomies.error.value_invalid';
|
||||
public const ERROR_VALUE_DUPLICATE = 'mautic.smartlinks.config.error.value_duplicate';
|
||||
public const ERROR_NAME_TAKEN = 'mt3s.smart_links.taxonomies.error.name_taken';
|
||||
public const ERROR_NAME_CHARACTERS = 'mt3s.smart_links.taxonomies.error.name_characters';
|
||||
public const ERROR_VALUE_INVALID = 'mt3s.smart_links.taxonomies.error.value_invalid';
|
||||
public const ERROR_VALUE_DUPLICATE = 'mt3s.smart_links.config.error.value_duplicate';
|
||||
|
||||
public function __construct(
|
||||
private readonly UtmTaxonomyModel $taxonomyModel,
|
||||
|
||||
Reference in new issue
Block a user