From 9d81d6c815d96f3fd8161b5a05c2564d4c17e5a4 Mon Sep 17 00:00:00 2001 From: Alexandre Gain <270117159+alexandregain-xprl@users.noreply.github.com> Date: Mon, 16 Nov 2026 15:47:30 +0100 Subject: [PATCH] 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. (core's mautic..model.\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. --- Assets/js/mt3s-mp-smartlinks.js | 14 +- Catalog/SmartLinkRedirectCode.php | 2 +- Catalog/SmartLinkRedirectEnumHelper.php | 2 +- Catalog/SmartLinkRedirectType.php | 2 +- Catalog/UtmParameterDefinition.php | 4 +- Config/config.php | 46 ++- Config/services.php | 26 +- Controller/AudienceController.php | 4 +- Controller/ProgramController.php | 13 +- Controller/SmartLinkController.php | 22 +- Controller/StakeholderController.php | 4 +- Controller/TaskController.php | 6 +- Controller/UtmTaxonomyController.php | 20 +- Entity/SmartLink.php | 4 +- .../UtmSettingsTransformer.php | 2 +- Form/Type/SmartLinkType.php | 44 +- Form/Type/SmartLinksConfigType.php | 9 +- Form/Type/SmartlinksSettingsType.php | 20 +- Form/Type/UtmParameterType.php | 26 +- Form/Type/UtmTaxonomyType.php | 18 +- Form/Type/UtmValueType.php | 16 +- Form/UtmFieldsApplicator.php | 10 +- Form/Validator/SmartLinkValidator.php | 18 +- Form/Validator/UtmSettingsValidator.php | 12 +- Form/Validator/UtmTaxonomyValidator.php | 8 +- .../MT3SMarketingProgramIntegration.php | 2 +- Integration/SmartlinksIntegration.php | 2 +- ...upport.php => SmartlinksConfigSupport.php} | 2 +- Model/AudienceModel.php | 2 +- Model/ProgramModel.php | 2 + Model/SmartLinkModel.php | 23 +- Model/StakeholderModel.php | 2 +- Model/TaskModel.php | 2 +- Model/UtmTaxonomyModel.php | 4 +- .../_config_smartlinksconfig_widget.html.twig | 54 +-- Resources/views/SmartLink/form.html.twig | 16 +- Resources/views/SmartLink/list.html.twig | 30 +- Resources/views/UtmTaxonomy/form.html.twig | 10 +- Resources/views/UtmTaxonomy/list.html.twig | 18 +- Service/SmartLinkShortUrlBuilder.php | 19 +- Service/UtmConfigurationNormalizer.php | 2 +- Service/UtmConfigurationProvider.php | 25 +- .../Unit/Catalog/UtmParameterCatalogTest.php | 6 +- .../Unit/Form/SmartlinksSettingsTypeTest.php | 20 +- Tests/Unit/Form/UtmFieldsApplicatorTest.php | 12 +- .../Service/UtmConfigurationProviderTest.php | 2 +- Translations/en_US/messages.ini | 383 +++++++++--------- Translations/en_US/validators.ini | 66 +-- Translations/fr_FR/messages.ini | 383 +++++++++--------- Translations/fr_FR/validators.ini | 66 +-- composer.json | 2 +- phpunit.xml.dist | 4 +- readme.md | 17 +- 53 files changed, 777 insertions(+), 751 deletions(-) rename Integration/Support/{ConfigSupport.php => SmartlinksConfigSupport.php} (79%) diff --git a/Assets/js/mt3s-mp-smartlinks.js b/Assets/js/mt3s-mp-smartlinks.js index 4db09ec..f541289 100644 --- a/Assets/js/mt3s-mp-smartlinks.js +++ b/Assets/js/mt3s-mp-smartlinks.js @@ -1,12 +1,12 @@ /** - * UTM Manager + * Smart Links (the plugin's second domain) * - * - Settings > Configuration > UTM Manager tab: delegated handlers only (the configuration - * page is loaded through Ajax). Showing / hiding the value editor by mode is done by - * Mautic's own data-show-on switcher. + * - Settings > Configuration > Smart Links Settings tab: delegated handlers only (the + * configuration page is loaded through Ajax). Showing / hiding the value editor by + * mode is done by Mautic's own data-show-on switcher. * - Smart Link form: short link preview, "Generate" a random slug, destination URL shown - * only for external redirects. Started by Mautic.smartlinksSmartLinkOnLoad(), which Mautic - * calls after it loads any page whose mauticContent is "smartlinksSmartLink". + * only for external redirects. Started by Mautic.mt3sMpSmartLinkOnLoad(), which Mautic + * calls after it loads any page whose mauticContent is "mt3sMpSmartLink". */ (function ($) { 'use strict'; @@ -195,7 +195,7 @@ $('#smartLinkMauticDestinationWrapper').toggleClass('hide', type !== 'mautic'); }; - Mautic.smartlinksSmartLinkOnLoad = function (container) { + Mautic.mt3sMpSmartLinkOnLoad = function (container) { var $wrapper = $(container).find('.smart-link-slug-group').first(); if ($wrapper.length) { diff --git a/Catalog/SmartLinkRedirectCode.php b/Catalog/SmartLinkRedirectCode.php index 684a0d1..109ba57 100644 --- a/Catalog/SmartLinkRedirectCode.php +++ b/Catalog/SmartLinkRedirectCode.php @@ -25,7 +25,7 @@ enum SmartLinkRedirectCode: int public function getLabelKey(): string { - return 'mautic.smartlinks.smart_links.redirect_code.'.$this->value; + return 'mt3s.smart_links.smart_links.redirect_code.'.$this->value; } public function isPermanent(): bool diff --git a/Catalog/SmartLinkRedirectEnumHelper.php b/Catalog/SmartLinkRedirectEnumHelper.php index d747030..95e2321 100644 --- a/Catalog/SmartLinkRedirectEnumHelper.php +++ b/Catalog/SmartLinkRedirectEnumHelper.php @@ -7,7 +7,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Catalog; use Symfony\Contracts\Translation\TranslatorInterface; /** - * Choice labels for Smart Link redirect enums: t("mautic.smartlinks.smart_links.redirect_.") + * Choice labels for Smart Link redirect enums: t("mt3s.smart_links.smart_links.redirect_.") * gives "301 - Moved permanently (permanent)" style labels shared by the form and the list view. */ trait SmartLinkRedirectEnumHelper diff --git a/Catalog/SmartLinkRedirectType.php b/Catalog/SmartLinkRedirectType.php index 376f5d7..099354a 100644 --- a/Catalog/SmartLinkRedirectType.php +++ b/Catalog/SmartLinkRedirectType.php @@ -19,7 +19,7 @@ enum SmartLinkRedirectType: string public function getLabelKey(): string { - return 'mautic.smartlinks.smart_links.redirect_type.'.($this->isMautic() ? self::MAUTIC : self::EXTERNAL); + return 'mt3s.smart_links.smart_links.redirect_type.'.($this->isMautic() ? self::MAUTIC : self::EXTERNAL); } public function isMautic(): bool diff --git a/Catalog/UtmParameterDefinition.php b/Catalog/UtmParameterDefinition.php index acce473..3a9c448 100644 --- a/Catalog/UtmParameterDefinition.php +++ b/Catalog/UtmParameterDefinition.php @@ -9,7 +9,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Catalog; */ final class UtmParameterDefinition { - private const TRANSLATION_PREFIX = 'mautic.smartlinks.config.parameter.'; + private const TRANSLATION_PREFIX = 'mt3s.smart_links.config.parameter.'; /** * @param string[] $suggestions Suggested values offered by the "Load suggested values" button @@ -54,6 +54,6 @@ final class UtmParameterDefinition public static function getSuggestionLabelKey(string $value): string { - return 'mautic.smartlinks.config.suggestion.'.$value; + return 'mt3s.smart_links.config.suggestion.'.$value; } } diff --git a/Config/config.php b/Config/config.php index 12c1481..0f9c6a6 100644 --- a/Config/config.php +++ b/Config/config.php @@ -5,7 +5,7 @@ declare(strict_types=1); return [ 'name' => 'MT3S Marketing Program', 'description' => 'MT3S Marketing: programs, tasks, audiences, and smart links with their UTM taxonomies.', - 'version' => '0.18.0', + 'version' => '0.18.1', 'author' => 'Experiential', 'routes' => [ @@ -47,20 +47,20 @@ return [ 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\AudienceController::executeAction', ], // Smart Links domain: the list and its object actions. - 'mautic_smartlinks_index' => [ + 'mt3s_smart_links_index' => [ 'path' => '/smart-links/{page}', 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\SmartLinkController::indexAction', ], - 'mautic_smartlinks_action' => [ + 'mt3s_smart_links_action' => [ 'path' => '/smart-links/{objectAction}/{objectId}', 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\SmartLinkController::executeAction', ], // UTM Taxonomies: the list and its object actions. - 'mautic_smartlinks_taxonomies' => [ + 'mt3s_smart_links_taxonomies' => [ 'path' => '/utm-taxonomies/{page}', 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\UtmTaxonomyController::indexAction', ], - 'mautic_smartlinks_taxonomy_action' => [ + 'mt3s_smart_links_taxonomy_action' => [ 'path' => '/utm-taxonomies/{objectAction}/{objectId}', 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\UtmTaxonomyController::executeAction', ], @@ -74,7 +74,7 @@ return [ // https://{short_link_domain}/l/{slug}: the public entry point of the Smart Links. // Public routes are served without the /s/ prefix and without authentication. 'public' => [ - 'mautic_smartlinks_go' => [ + 'mt3s_smart_links_go' => [ 'path' => '/l/{slug}', 'controller' => 'MauticPlugin\MT3SMarketingProgramBundle\Controller\PublicController::goAction', ], @@ -125,9 +125,9 @@ return [ // Top-level "Smart Links" menu: UTM Taxonomies above the Smart Links list. The two // domains (Marketing Program and Smart Links) stay separate menu groups. - 'mautic.smartlinks.menu.root' => [ - 'id' => 'mautic_smartlinks', - 'route' => 'mautic_smartlinks_index', + 'mt3s.smart_links.menu.root' => [ + 'id' => 'mt3s_smart_links', + 'route' => 'mt3s_smart_links_index', 'iconClass' => 'ri-links-line', 'access' => [ 'mt3smarketingprogram:smart_links:viewown', @@ -137,16 +137,16 @@ return [ ], 'priority' => 4, 'children' => [ - 'mautic.smartlinks.menu.taxonomies' => [ - 'id' => 'mautic_smartlinks_taxonomies', - 'route' => 'mautic_smartlinks_taxonomies', + 'mt3s.smart_links.menu.taxonomies' => [ + 'id' => 'mt3s_smart_links_taxonomies', + 'route' => 'mt3s_smart_links_taxonomies', 'iconClass' => 'ri-price-tag-3-line', 'access' => ['mt3smarketingprogram:taxonomies:viewown', 'mt3smarketingprogram:taxonomies:viewother'], 'priority' => 5, ], - 'mautic.smartlinks.menu.smartlinks' => [ - 'id' => 'mautic_smartlinks_index', - 'route' => 'mautic_smartlinks_index', + 'mt3s.smart_links.menu.smartlinks' => [ + 'id' => 'mt3s_smart_links_index', + 'route' => 'mt3s_smart_links_index', 'iconClass' => 'ri-link', 'access' => ['mt3smarketingprogram:smart_links:viewown', 'mt3smarketingprogram:smart_links:viewother'], 'priority' => 4, @@ -179,7 +179,7 @@ return [ ], ], 'mt3s.smart_links.integration.configuration' => [ - 'class' => MauticPlugin\MT3SMarketingProgramBundle\Integration\Support\ConfigSupport::class, + 'class' => MauticPlugin\MT3SMarketingProgramBundle\Integration\Support\SmartlinksConfigSupport::class, 'tags' => [ 'mautic.config_integration', ], @@ -237,13 +237,19 @@ return [ // Stored by Settings > Configuration > Smart Links Settings (SmartLinksConfigSubscriber). // Read through UtmConfigurationProvider; the default stays empty, the catalog // defaults are applied by UtmConfigurationNormalizer. + 'mt3s_smart_links_utm_config' => [], + 'mt3s_smart_links_config' => [ + 'short_link_domain' => '', + ], + // Legacy keys of the earlier eras. Declared so the read fallbacks + // (UtmConfigurationProvider, SmartLinkModel, SmartLinkShortUrlBuilder) can serve + // upgrades from local.php until the settings are saved again; new values are + // always written to the new keys: `smartlinks_*` (the standalone + // SmartlinksBundle, 0.1.0–0.18.0) and `utm_manager_*` (the UtmManagerBundle, < 0.5.0). 'smartlinks_utm_config' => [], - 'smartlinks_config' => [ + 'smartlinks_config' => [ 'short_link_domain' => '', ], - // Legacy keys of the standalone Smartlinks plugin era (< 0.18.0). Declared so the - // read fallbacks can serve upgrades from local.php until the settings are saved - // again; new values are always written to the new keys. 'utm_manager_config' => [], 'utm_manager_smart_links' => [ 'short_link_domain' => '', diff --git a/Config/services.php b/Config/services.php index 86acc71..16c86c5 100644 --- a/Config/services.php +++ b/Config/services.php @@ -25,21 +25,13 @@ return function (ContainerConfigurator $configurator): void { $services->load('MauticPlugin\\MT3SMarketingProgramBundle\\Entity\\', '../Entity/*Repository.php') ->tag(Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\ServiceRepositoryCompilerPass::REPOSITORY_SERVICE_TAG); - // Lets core resolve the model with getModel('mt3smp.program'). - $services->alias('mt3s.marketing_program.model.program', MauticPlugin\MT3SMarketingProgramBundle\Model\ProgramModel::class); - $services->alias('mautic.mt3smp.model.program', MauticPlugin\MT3SMarketingProgramBundle\Model\ProgramModel::class); - // getModel('mt3smp.task'). - $services->alias('mt3s.marketing_program.model.task', MauticPlugin\MT3SMarketingProgramBundle\Model\TaskModel::class); - $services->alias('mautic.mt3smp.model.task', MauticPlugin\MT3SMarketingProgramBundle\Model\TaskModel::class); - // getModel('mt3smp.stakeholder'). - $services->alias('mt3s.marketing_program.model.stakeholder', MauticPlugin\MT3SMarketingProgramBundle\Model\StakeholderModel::class); - $services->alias('mautic.mt3smp.model.stakeholder', MauticPlugin\MT3SMarketingProgramBundle\Model\StakeholderModel::class); - // getModel('mt3smp.audience'). - $services->alias('mt3s.marketing_program.model.audience', MauticPlugin\MT3SMarketingProgramBundle\Model\AudienceModel::class); - // Smart Links domain: getModel('smartlinks.smart_link') / getModel('smartlinks.utm_taxonomy'). - $services->alias('mt3s.smart_links.model.smart_link', MauticPlugin\MT3SMarketingProgramBundle\Model\SmartLinkModel::class); - $services->alias('mautic.smartlinks.model.smart_link', MauticPlugin\MT3SMarketingProgramBundle\Model\SmartLinkModel::class); - $services->alias('mt3s.smart_links.model.utm_taxonomy', MauticPlugin\MT3SMarketingProgramBundle\Model\UtmTaxonomyModel::class); - $services->alias('mautic.smartlinks.model.utm_taxonomy', MauticPlugin\MT3SMarketingProgramBundle\Model\UtmTaxonomyModel::class); - $services->alias('mautic.mt3smp.model.audience', MauticPlugin\MT3SMarketingProgramBundle\Model\AudienceModel::class); + // Core resolves getModel('mt3smarketingprogram.') to mautic.mt3smarketingprogram.model.: + // exactly one alias per model, under the bundle's canonical prefix. + $services->alias('mautic.mt3smarketingprogram.model.program', MauticPlugin\MT3SMarketingProgramBundle\Model\ProgramModel::class); + $services->alias('mautic.mt3smarketingprogram.model.task', MauticPlugin\MT3SMarketingProgramBundle\Model\TaskModel::class); + $services->alias('mautic.mt3smarketingprogram.model.stakeholder', MauticPlugin\MT3SMarketingProgramBundle\Model\StakeholderModel::class); + $services->alias('mautic.mt3smarketingprogram.model.audience', MauticPlugin\MT3SMarketingProgramBundle\Model\AudienceModel::class); + // Smart Links domain: getModel('mt3smarketingprogram.smart_link') / getModel('mt3smarketingprogram.utm_taxonomy'). + $services->alias('mautic.mt3smarketingprogram.model.smart_link', MauticPlugin\MT3SMarketingProgramBundle\Model\SmartLinkModel::class); + $services->alias('mautic.mt3smarketingprogram.model.utm_taxonomy', MauticPlugin\MT3SMarketingProgramBundle\Model\UtmTaxonomyModel::class); }; diff --git a/Controller/AudienceController.php b/Controller/AudienceController.php index 0e4e2bb..127b7a0 100644 --- a/Controller/AudienceController.php +++ b/Controller/AudienceController.php @@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\Response; * link to them from their Audiences tab (ProgramAudience carries the audience's priority in that * program). * - * Model mt3smp.audience (mt3s.marketing_program.model.audience), permission base mt3smarketingprogram:audiences, translation + * Model mt3smarketingprogram.audience (mautic.mt3smarketingprogram.model.audience), permission base mt3smarketingprogram:audiences, translation * base mt3s.marketing_program.audience. */ class AudienceController extends AbstractStandardFormController @@ -24,7 +24,7 @@ class AudienceController extends AbstractStandardFormController protected function getModelName(): string { - return 'mt3smp.audience'; + return 'mt3smarketingprogram.audience'; } protected function getTemplateBase(): string diff --git a/Controller/ProgramController.php b/Controller/ProgramController.php index 61d980e..2d82426 100644 --- a/Controller/ProgramController.php +++ b/Controller/ProgramController.php @@ -11,10 +11,11 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; /** - * List, view, create, edit and delete plans, using core's standard CRUD flow. + * List, view, create, edit and delete marketing programs, using core's standard CRUD flow. * - * Core derives most names from the model name "program": model mt3s.marketing_program.model.program, permission base - * mt3smarketingprogram:programs (from ProgramModel), translation base mt3s.marketing_program, session base mt3s.marketing_program. + * Core derives the model alias and the permission base from the model name + * "mt3smarketingprogram.program": model mautic.mt3smarketingprogram.model.program, permission + * base mt3smarketingprogram:programs (from ProgramModel). The views translate under mt3s.marketing_program.*. */ class ProgramController extends AbstractStandardFormController { @@ -23,7 +24,7 @@ class ProgramController extends AbstractStandardFormController protected function getModelName(): string { - return 'mt3smp.program'; + return 'mt3smarketingprogram.program'; } protected function getTemplateBase(): string @@ -47,7 +48,7 @@ class ProgramController extends AbstractStandardFormController /** * The OnLoad JS prefix: core dispatches Mautic[getJsLoadMethodPrefix() + "OnLoad"]() * (mt3sMpProgramOnLoad in Assets/js/mt3s-mp-program.js). Without this override, core - * falls back to the model name ("mt3smp.program"), which nothing listens to. + * falls back to the model name ("mt3smarketingprogram.program"), which nothing listens to. */ protected function getJsLoadMethodPrefix(): string { @@ -148,7 +149,7 @@ class ProgramController extends AbstractStandardFormController private function getTaskModel(): TaskModel { - $model = $this->getModel('mt3smp.task'); + $model = $this->getModel('mt3smarketingprogram.task'); \assert($model instanceof TaskModel); return $model; diff --git a/Controller/SmartLinkController.php b/Controller/SmartLinkController.php index 950c41f..291fe1d 100644 --- a/Controller/SmartLinkController.php +++ b/Controller/SmartLinkController.php @@ -14,8 +14,8 @@ use Symfony\Component\HttpFoundation\Response; /** * Create, edit and delete Smart Links (main menu > Smart Links), using core's standard CRUD flow. * - * Model smartlinks.smart_link (mautic.smartlinks.model.smart_link), permission base - * smartlinks:smart_links, translation base mautic.smartlinks.smart_links. + * Model mt3smarketingprogram.smart_link (mautic.mt3smarketingprogram.model.smart_link), permission base + * mt3smarketingprogram:smart_links, translation base mt3s.smart_links.smart_links. * * The slug of a saved link is immutable: the form disables the field, the model refuses another * slug, and this controller drops the submitted value (nothing to re-check). There is no clone: @@ -23,12 +23,12 @@ use Symfony\Component\HttpFoundation\Response; */ class SmartLinkController extends AbstractStandardFormController { - public const ROUTE_INDEX = 'mautic_smartlinks_index'; - public const ROUTE_ACTION = 'mautic_smartlinks_action'; + public const ROUTE_INDEX = 'mt3s_smart_links_index'; + public const ROUTE_ACTION = 'mt3s_smart_links_action'; protected function getModelName(): string { - return 'smartlinks.smart_link'; + return 'mt3smarketingprogram.smart_link'; } protected function getTemplateBase(): string @@ -47,20 +47,22 @@ class SmartLinkController extends AbstractStandardFormController } /** - * Core builds mautic_smartlinkssmartlink from the model name; the JS loader relies on this prefix. + * The OnLoad JS prefix: core dispatches Mautic[getJsLoadMethodPrefix() + "OnLoad"]() + * (Mautic.mt3sMpSmartLinkOnLoad in Assets/js/mt3s-mp-smartlinks.js). Without this + * override, core falls back to the model name, which nothing listens to. */ protected function getJsLoadMethodPrefix(): string { - return 'smartlinksSmartLink'; + return 'mt3sMpSmartLink'; } /** * Core builds mautic. (singular smart_link); every key of the feature lives - * under mautic.smartlinks.smart_links. + * under mt3s.smart_links.smart_links. */ protected function getTranslationBase(): string { - return 'mautic.smartlinks.smart_links'; + return 'mt3s.smart_links.smart_links'; } /** @@ -107,7 +109,7 @@ class SmartLinkController extends AbstractStandardFormController if ($entity instanceof SmartLink && null !== $entity->getId()) { $formSlug = $form->has('slug') ? (string) $form->get('slug')->getData() : ''; if ('' !== $formSlug && $formSlug !== (string) $entity->getSlug()) { - $this->addFlashMessage('mautic.smartlinks.smart_links.error.slug_immutable', ['%slug%' => $formSlug], \Mautic\CoreBundle\FlashBag::LEVEL_ERROR); + $this->addFlashMessage('mt3s.smart_links.smart_links.error.slug_immutable', ['%slug%' => $formSlug], \Mautic\CoreBundle\FlashBag::LEVEL_ERROR); return false; } diff --git a/Controller/StakeholderController.php b/Controller/StakeholderController.php index d6c431b..603fa43 100644 --- a/Controller/StakeholderController.php +++ b/Controller/StakeholderController.php @@ -13,7 +13,7 @@ use Symfony\Component\HttpFoundation\Response; * core's standard CRUD flow. Stakeholders are independent of programs; programs link to them from their * Stakeholders tab. * - * Model mt3smp.stakeholder (mt3s.marketing_program.model.stakeholder), permission base mt3smarketingprogram:stakeholders, + * Model mt3smarketingprogram.stakeholder (mautic.mt3smarketingprogram.model.stakeholder), permission base mt3smarketingprogram:stakeholders, * translation base mt3s.marketing_program.stakeholder. */ class StakeholderController extends AbstractStandardFormController @@ -23,7 +23,7 @@ class StakeholderController extends AbstractStandardFormController protected function getModelName(): string { - return 'mt3smp.stakeholder'; + return 'mt3smarketingprogram.stakeholder'; } protected function getTemplateBase(): string diff --git a/Controller/TaskController.php b/Controller/TaskController.php index 652e246..64234b9 100644 --- a/Controller/TaskController.php +++ b/Controller/TaskController.php @@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\Response; /** * List, create, edit and delete tasks (Programs > Tasks), using core's standard CRUD flow. * - * Model mt3smp.task (mt3s.marketing_program.model.task), permission base mt3smarketingprogram:tasks, translation base mt3s.marketing_program.task. + * Model mt3smarketingprogram.task (mautic.mt3smarketingprogram.model.task), permission base mt3smarketingprogram:tasks, translation base mt3s.marketing_program.task. * * Where the user lands after Save or Cancel depends on where the task form was opened from: * - from Programs > Tasks: back to the task list (core's default); @@ -51,7 +51,7 @@ class TaskController extends AbstractStandardFormController protected function getModelName(): string { - return 'mt3smp.task'; + return 'mt3smarketingprogram.task'; } protected function getTemplateBase(): string @@ -144,7 +144,7 @@ class TaskController extends AbstractStandardFormController $entity = parent::getFormEntity($action, $objectId, $isClone); if ('new' === $action && $entity instanceof Task && null === $entity->getProgram() && null !== $this->preselectedProgramId) { - $program = $this->getModel('mt3smp.program')->getEntity($this->preselectedProgramId); + $program = $this->getModel('mt3smarketingprogram.program')->getEntity($this->preselectedProgramId); if ($program instanceof Program) { $entity->setProgram($program); } diff --git a/Controller/UtmTaxonomyController.php b/Controller/UtmTaxonomyController.php index dd17c4b..7211bb9 100644 --- a/Controller/UtmTaxonomyController.php +++ b/Controller/UtmTaxonomyController.php @@ -12,20 +12,20 @@ use Symfony\Component\HttpFoundation\Response; * Create, edit and delete UTM Taxonomies (Smart Links > UTM Taxonomies), using core's standard * CRUD flow. * - * Model smartlinks.utm_taxonomy (mautic.smartlinks.model.utm_taxonomy), permission base - * smartlinks:taxonomies, translation base mautic.smartlinks.taxonomies. + * Model mt3smarketingprogram.utm_taxonomy (mautic.mt3smarketingprogram.model.utm_taxonomy), permission base + * mt3smarketingprogram:taxonomies, translation base mt3s.smart_links.taxonomies. * * A taxonomy is never cloned: its name is unique, and a clone would collide immediately. A new * taxonomy is created from scratch. */ class UtmTaxonomyController extends AbstractStandardFormController { - public const ROUTE_INDEX = 'mautic_smartlinks_taxonomies'; - public const ROUTE_ACTION = 'mautic_smartlinks_taxonomy_action'; + public const ROUTE_INDEX = 'mt3s_smart_links_taxonomies'; + public const ROUTE_ACTION = 'mt3s_smart_links_taxonomy_action'; protected function getModelName(): string { - return 'smartlinks.utm_taxonomy'; + return 'mt3smarketingprogram.utm_taxonomy'; } protected function getTemplateBase(): string @@ -44,20 +44,20 @@ class UtmTaxonomyController extends AbstractStandardFormController } /** - * Core derives the JS loader method from the model name; no Mautic.OnLoad exists for - * taxonomies (the form needs none), but the prefix stays deterministic for future use. + * The OnLoad JS prefix (no Mautic.mt3sMpUtmTaxonomyOnLoad exists: the form needs none), + * deterministic for future use; core's fallback, the model name, would nothing listen to. */ protected function getJsLoadMethodPrefix(): string { - return 'smartlinksUtmTaxonomy'; + return 'mt3sMpUtmTaxonomy'; } /** - * Core builds mautic.; every key of the feature lives under mautic.smartlinks.taxonomies. + * Core builds mautic.; every key of the feature lives under mt3s.smart_links.taxonomies. */ protected function getTranslationBase(): string { - return 'mautic.smartlinks.taxonomies'; + return 'mt3s.smart_links.taxonomies'; } /** diff --git a/Entity/SmartLink.php b/Entity/SmartLink.php index 7940159..f0037a2 100644 --- a/Entity/SmartLink.php +++ b/Entity/SmartLink.php @@ -126,10 +126,10 @@ class SmartLink extends FormEntity public static function loadValidatorMetadata(ClassMetadata $metadata): void { - $metadata->addPropertyConstraint('slug', new NotBlank(message: 'mautic.smartlinks.smart_links.error.slug_required')); + $metadata->addPropertyConstraint('slug', new NotBlank(message: 'mt3s.smart_links.smart_links.error.slug_required')); $metadata->addPropertyConstraint('slug', new Length( max: self::SLUG_MAX_LENGTH, - maxMessage: 'mautic.smartlinks.smart_links.error.slug_length', + maxMessage: 'mt3s.smart_links.smart_links.error.slug_length', )); } diff --git a/Form/DataTransformer/UtmSettingsTransformer.php b/Form/DataTransformer/UtmSettingsTransformer.php index 96c8fe7..14d85c4 100644 --- a/Form/DataTransformer/UtmSettingsTransformer.php +++ b/Form/DataTransformer/UtmSettingsTransformer.php @@ -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> diff --git a/Form/Type/SmartLinkType.php b/Form/Type/SmartLinkType.php index ed70615..50f61da 100644 --- a/Form/Type/SmartLinkType.php +++ b/Form/Type/SmartLinkType.php @@ -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; diff --git a/Form/Type/SmartLinksConfigType.php b/Form/Type/SmartLinksConfigType.php index ca46c52..d2060d3 100644 --- a/Form/Type/SmartLinksConfigType.php +++ b/Form/Type/SmartLinksConfigType.php @@ -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', ], ]); } diff --git a/Form/Type/SmartlinksSettingsType.php b/Form/Type/SmartlinksSettingsType.php index 5f4da13..63dae45 100644 --- a/Form/Type/SmartlinksSettingsType.php +++ b/Form/Type/SmartlinksSettingsType.php @@ -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> */ @@ -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'; } } diff --git a/Form/Type/UtmParameterType.php b/Form/Type/UtmParameterType.php index 0eb8944..47b2279 100644 --- a/Form/Type/UtmParameterType.php +++ b/Form/Type/UtmParameterType.php @@ -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 diff --git a/Form/Type/UtmTaxonomyType.php b/Form/Type/UtmTaxonomyType.php index 63446cc..603799e 100644 --- a/Form/Type/UtmTaxonomyType.php +++ b/Form/Type/UtmTaxonomyType.php @@ -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', ], ]); } diff --git a/Form/Type/UtmValueType.php b/Form/Type/UtmValueType.php index 6d2df38..f556b50 100644 --- a/Form/Type/UtmValueType.php +++ b/Form/Type/UtmValueType.php @@ -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'], ]); diff --git a/Form/UtmFieldsApplicator.php b/Form/UtmFieldsApplicator.php index b4d38c6..4ad0d8f 100644 --- a/Form/UtmFieldsApplicator.php +++ b/Form/UtmFieldsApplicator.php @@ -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) { diff --git a/Form/Validator/SmartLinkValidator.php b/Form/Validator/SmartLinkValidator.php index 6a67ebc..2cd1cd0 100644 --- a/Form/Validator/SmartLinkValidator.php +++ b/Form/Validator/SmartLinkValidator.php @@ -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, diff --git a/Form/Validator/UtmSettingsValidator.php b/Form/Validator/UtmSettingsValidator.php index f609a3e..ca8716a 100644 --- a/Form/Validator/UtmSettingsValidator.php +++ b/Form/Validator/UtmSettingsValidator.php @@ -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, diff --git a/Form/Validator/UtmTaxonomyValidator.php b/Form/Validator/UtmTaxonomyValidator.php index 967d23a..6ac2597 100644 --- a/Form/Validator/UtmTaxonomyValidator.php +++ b/Form/Validator/UtmTaxonomyValidator.php @@ -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, diff --git a/Integration/MT3SMarketingProgramIntegration.php b/Integration/MT3SMarketingProgramIntegration.php index d0acdce..ef94650 100644 --- a/Integration/MT3SMarketingProgramIntegration.php +++ b/Integration/MT3SMarketingProgramIntegration.php @@ -13,7 +13,7 @@ class MT3SMarketingProgramIntegration extends BasicIntegration implements BasicI use ConfigurationTrait; public const NAME = 'MT3SMarketingProgram'; - public const DISPLAY_NAME = 'Marketing Programs'; + public const DISPLAY_NAME = 'MT3S Marketing Program'; public function getName(): string { diff --git a/Integration/SmartlinksIntegration.php b/Integration/SmartlinksIntegration.php index 22b85fa..c8b062d 100644 --- a/Integration/SmartlinksIntegration.php +++ b/Integration/SmartlinksIntegration.php @@ -13,7 +13,7 @@ class SmartlinksIntegration extends BasicIntegration implements BasicInterface use ConfigurationTrait; public const NAME = 'Smartlinks'; - public const DISPLAY_NAME = 'Smartlinks'; + public const DISPLAY_NAME = 'Smart Links'; public function getName(): string { diff --git a/Integration/Support/ConfigSupport.php b/Integration/Support/SmartlinksConfigSupport.php similarity index 79% rename from Integration/Support/ConfigSupport.php rename to Integration/Support/SmartlinksConfigSupport.php index ec68c5d..8e7332a 100644 --- a/Integration/Support/ConfigSupport.php +++ b/Integration/Support/SmartlinksConfigSupport.php @@ -8,7 +8,7 @@ use Mautic\IntegrationsBundle\Integration\DefaultConfigFormTrait; use Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormInterface; use MauticPlugin\MT3SMarketingProgramBundle\Integration\SmartlinksIntegration; -class ConfigSupport extends SmartlinksIntegration implements ConfigFormInterface +class SmartlinksConfigSupport extends SmartlinksIntegration implements ConfigFormInterface { use DefaultConfigFormTrait; } diff --git a/Model/AudienceModel.php b/Model/AudienceModel.php index cb668cc..50c9fc8 100644 --- a/Model/AudienceModel.php +++ b/Model/AudienceModel.php @@ -13,7 +13,7 @@ use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; /** - * Available as mt3s.marketing_program.model.audience, or getModel('mt3smp.audience'). + * Available as mautic.mt3smarketingprogram.model.audience, or getModel('mt3smarketingprogram.audience'). * * Audiences are a global directory (Programs > Audiences), independent of plans; plans link to * them from their Audiences tab through ProgramAudience (which carries the audience's priority in diff --git a/Model/ProgramModel.php b/Model/ProgramModel.php index 78970a9..8798aae 100644 --- a/Model/ProgramModel.php +++ b/Model/ProgramModel.php @@ -15,6 +15,8 @@ use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; /** + * Available as mautic.mt3smarketingprogram.model.program, or getModel('mt3smarketingprogram.program'). + * * @extends FormModel */ class ProgramModel extends FormModel diff --git a/Model/SmartLinkModel.php b/Model/SmartLinkModel.php index deaa66e..b4f76ed 100644 --- a/Model/SmartLinkModel.php +++ b/Model/SmartLinkModel.php @@ -26,13 +26,13 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** - * Available as mautic.smartlinks.model.smart_link, or getModel('smartlinks.smart_link'). + * Available as mautic.mt3smarketingprogram.model.smart_link, or getModel('mt3smarketingprogram.smart_link'). * * @extends FormModel */ class SmartLinkModel extends FormModel { - public const MODEL_NAME = 'smartlinks.smart_link'; + public const MODEL_NAME = 'mt3smarketingprogram.smart_link'; /** Random slugs offered by the "Generate" button: 4 characters, letters and digits. */ public const GENERATED_SLUG_LENGTH = 4; @@ -181,12 +181,19 @@ class SmartLinkModel extends FormModel { $stored = $this->coreParametersHelper->get(\MauticPlugin\MT3SMarketingProgramBundle\Form\Type\SmartLinksConfigType::CONFIG_PARAMETER, []); - // Upgrades from < 0.5.0 keep the domain in local.php under the legacy key; serve it until - // the Configuration page is saved again (which writes the new key). - if (!is_array($stored) || '' === trim((string) ($stored['short_link_domain'] ?? ''))) { - $legacy = $this->coreParametersHelper->get(\MauticPlugin\MT3SMarketingProgramBundle\Form\Type\SmartLinksConfigType::LEGACY_CONFIG_PARAMETER, []); - if (is_array($legacy) && '' !== trim((string) ($legacy['short_link_domain'] ?? ''))) { - $stored = $legacy; + // Upgrades keep the domain in local.php under a legacy key (the standalone + // SmartlinksBundle wrote `smartlinks_config`, the UtmManagerBundle before it + // `utm_manager_smart_links`); serve it until the Configuration page is saved again. + $legacyKeys = [ + \MauticPlugin\MT3SMarketingProgramBundle\Form\Type\SmartLinksConfigType::LEGACY_SMARTLINKS_PARAMETER, + \MauticPlugin\MT3SMarketingProgramBundle\Form\Type\SmartLinksConfigType::LEGACY_CONFIG_PARAMETER, + ]; + foreach ($legacyKeys as $legacyKey) { + if (!is_array($stored) || '' === trim((string) ($stored['short_link_domain'] ?? ''))) { + $legacy = $this->coreParametersHelper->get($legacyKey, []); + if (is_array($legacy) && '' !== trim((string) ($legacy['short_link_domain'] ?? ''))) { + $stored = $legacy; + } } } diff --git a/Model/StakeholderModel.php b/Model/StakeholderModel.php index 8f03a36..c7375a5 100644 --- a/Model/StakeholderModel.php +++ b/Model/StakeholderModel.php @@ -16,7 +16,7 @@ use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; /** - * Available as mt3s.marketing_program.model.stakeholder, or getModel('mt3smp.stakeholder'). + * Available as mautic.mt3smarketingprogram.model.stakeholder, or getModel('mt3smarketingprogram.stakeholder'). * * On save, the phone number is normalized to E.164 using the default region from Settings > * Configuration > Program Settings (parameter mt3s_marketing_program_stakeholder_phone_region, FR by default). A number that diff --git a/Model/TaskModel.php b/Model/TaskModel.php index 6a1de3f..faefc15 100644 --- a/Model/TaskModel.php +++ b/Model/TaskModel.php @@ -14,7 +14,7 @@ use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; /** - * Available as mt3s.marketing_program.model.task, or getModel('mt3smp.task'). + * Available as mautic.mt3smarketingprogram.model.task, or getModel('mt3smarketingprogram.task'). * * @extends FormModel */ diff --git a/Model/UtmTaxonomyModel.php b/Model/UtmTaxonomyModel.php index 22b2ff2..e145f5d 100644 --- a/Model/UtmTaxonomyModel.php +++ b/Model/UtmTaxonomyModel.php @@ -21,13 +21,13 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Contracts\Translation\TranslatorInterface; /** - * Available as mautic.smartlinks.model.utm_taxonomy, or getModel('smartlinks.utm_taxonomy'). + * Available as mautic.mt3smarketingprogram.model.utm_taxonomy, or getModel('mt3smarketingprogram.utm_taxonomy'). * * @extends FormModel */ class UtmTaxonomyModel extends FormModel { - public const MODEL_NAME = 'smartlinks.utm_taxonomy'; + public const MODEL_NAME = 'mt3smarketingprogram.utm_taxonomy'; public function __construct( EntityManagerInterface $em, diff --git a/Resources/views/FormTheme/Config/_config_smartlinksconfig_widget.html.twig b/Resources/views/FormTheme/Config/_config_smartlinksconfig_widget.html.twig index cf82232..5ca67fe 100644 --- a/Resources/views/FormTheme/Config/_config_smartlinksconfig_widget.html.twig +++ b/Resources/views/FormTheme/Config/_config_smartlinksconfig_widget.html.twig @@ -1,16 +1,16 @@ {# Settings > Configuration > Smart Links Settings: the single tab of the plugin. Section "UTM Settings": the general rules and the short link domain. Section "Parameters": the catalog and - custom parameters. Behaviour (rows, import, suggestions) lives in Assets/js/smartlinks.js. #} + custom parameters. Behaviour (rows, import, suggestions) lives in Assets/js/mt3s-mp-smartlinks.js. #} {% block _config_smartlinksconfig_widget %} -{% set utm = form.children.smartlinks_utm_config %} -{% set links = form.children.smartlinks_config %} -
{{ 'mautic.smartlinks.settings.description'|trans }}
+{% set utm = form.children.mt3s_smart_links_utm_config %} +{% set links = form.children.mt3s_smart_links_config %} +
{{ 'mt3s.smart_links.settings.description'|trans }}
{{ form_errors(utm) }} {{ form_errors(links) }}