Compare commits
3
Commits
post-merge-v1
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b138056e43 | ||
|
|
07773acb8d | ||
|
|
9d81d6c815 |
No files matched your search
@@ -0,0 +1,28 @@
|
||||
# Coding standards of the plugin: the same ruleset Mautic core runs
|
||||
# (@Symfony + the core tweaks, see .php-cs-fixer.dist.php) and PHPStan level 6
|
||||
# (see phpstan.neon). `composer install` in the plugin directory pulls
|
||||
# mautic/core-lib (^7.0) so the analysis sees the real Mautic signatures.
|
||||
#
|
||||
# The PHPUnit suite is not run here: it needs a full Mautic installation
|
||||
# (see Tests/bootstrap.php). Run it from the mautic-dev-env container:
|
||||
# vendor/bin/phpunit -c docroot/plugins/MT3SMarketingProgramBundle/phpunit.xml.dist
|
||||
|
||||
stages:
|
||||
- lint
|
||||
|
||||
.default-before-script: &default-before-script
|
||||
- composer install --no-interaction --no-progress --prefer-dist
|
||||
|
||||
php-cs-fixer:
|
||||
stage: lint
|
||||
image: composer:2
|
||||
before_script: *default-before-script
|
||||
script:
|
||||
- composer cs-check
|
||||
|
||||
phpstan:
|
||||
stage: lint
|
||||
image: composer:2
|
||||
before_script: *default-before-script
|
||||
script:
|
||||
- composer phpstan
|
||||
@@ -0,0 +1 @@
|
||||
{"php":"8.3.36","version":"3.95.32:v3.95.32#c12acc751f4039935429057f1fadf0e5f62601c1","indent":" ","lineEnding":"\n","rules":{"align_multiline_comment":true,"backtick_to_shell_exec":true,"binary_operator_spaces":{"operators":{"=>":"align","=":"align"}},"blank_line_before_statement":{"statements":["return"]},"braces_position":{"allow_single_line_anonymous_functions":true,"allow_single_line_empty_anonymous_classes":true},"class_attributes_separation":{"elements":{"method":"one"}},"class_definition":{"single_line":true},"class_reference_name_casing":true,"clean_namespace":true,"concat_space":true,"declare_parentheses":true,"echo_tag_syntax":true,"empty_loop_body":{"style":"braces"},"empty_loop_condition":true,"fully_qualified_strict_types":true,"function_declaration":{"closure_fn_spacing":"one"},"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":false,"import_constants":false,"import_functions":false},"include":true,"increment_style":true,"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"after_heredoc":true,"on_multiline":"ignore"},"native_function_casing":true,"native_type_declaration_casing":true,"no_alias_language_construct_call":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["attribute","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use"]},"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"allow_mixed":true},"no_trailing_comma_in_singleline":true,"no_unneeded_braces":{"namespaces":true},"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","negative_instanceof","others","return","switch_case","yield","yield_from"]},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_else":true,"no_useless_nullsafe_operator":true,"no_useless_return":true,"no_whitespace_before_comma_in_array":{"after_heredoc":true},"normalize_index_brace":true,"object_operator_without_whitespace":true,"operator_linebreak":{"only_booleans":true},"ordered_imports":true,"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":{"replacements":{"const":"var","link":"see","property-read":"property","property-write":"property","type":"var"}},"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":{"order":["param","return","throws"]},"phpdoc_return_self_reference":true,"phpdoc_scalar":{"types":["boolean","callback","double","integer","never-return","never-returns","no-return","real","str"]},"phpdoc_separation":{"groups":[["Annotation","NamedArgumentConstructor","Target"],["author","copyright","license"],["category","package","subpackage"],["property","property-read","property-write"],["deprecated","link","see","since"]],"skip_unlisted_annotations":false},"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_annotation_correct_order":true,"phpdoc_var_without_name":true,"protected_to_private":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_import_per_statement":true,"single_line_comment_spacing":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_space_around_construct":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"statement_indentation":{"stick_comment_to_next_continuous_control_statement":true},"switch_continue_to_break":true,"trailing_comma_in_multiline":{"after_heredoc":true,"elements":["array_destructuring","arrays","match","parameters"]},"trim_array_spaces":true,"type_declaration_spaces":{"elements":["function","property"]},"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true,"nullable_type_declaration":true,"ordered_types":{"null_adjustment":"always_last","sort_algorithm":"none"},"single_class_element_per_statement":true,"types_spaces":true,"array_indentation":true,"array_syntax":{"syntax":"short"},"attribute_block_no_spaces":true,"cast_spaces":true,"new_with_parentheses":{"anonymouLine truncated
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* PHP-CS-Fixer configuration of the plugin: the same ruleset Mautic core runs
|
||||
* (see its .php-cs-fixer.php), minus the custom fixer of the mautic/coding-standards
|
||||
* package, which a standalone plugin repository cannot require.
|
||||
*
|
||||
* Check the coding style (CI runs this with --dry-run --diff):
|
||||
*
|
||||
* vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php-cs-fixer.dist.php
|
||||
*
|
||||
* Fix in place:
|
||||
*
|
||||
* vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php
|
||||
*/
|
||||
|
||||
$finder = (new PhpCsFixer\Finder())
|
||||
->in([
|
||||
__DIR__.'/Catalog',
|
||||
__DIR__.'/Command',
|
||||
__DIR__.'/Config',
|
||||
__DIR__.'/Controller',
|
||||
__DIR__.'/DependencyInjection',
|
||||
__DIR__.'/Entity',
|
||||
__DIR__.'/Event',
|
||||
__DIR__.'/EventListener',
|
||||
__DIR__.'/Form',
|
||||
__DIR__.'/Integration',
|
||||
__DIR__.'/Migrations',
|
||||
__DIR__.'/Model',
|
||||
__DIR__.'/Security',
|
||||
__DIR__.'/Service',
|
||||
__DIR__.'/Tests',
|
||||
__DIR__.'/Twig',
|
||||
__DIR__.'/Validator',
|
||||
])
|
||||
->append([
|
||||
__DIR__.'/MT3SMarketingProgramBundle.php',
|
||||
]);
|
||||
|
||||
return (new PhpCsFixer\Config())
|
||||
->setRules([
|
||||
'@Symfony' => true,
|
||||
'binary_operator_spaces' => [
|
||||
'operators' => [
|
||||
'=>' => 'align',
|
||||
'=' => 'align',
|
||||
],
|
||||
],
|
||||
'phpdoc_to_comment' => false,
|
||||
'ordered_imports' => true,
|
||||
'array_syntax' => [
|
||||
'syntax' => 'short',
|
||||
],
|
||||
'no_unused_imports' => true,
|
||||
/**
|
||||
* The plugin's templates use the alternative syntax (endforeach, endif, ...)
|
||||
* that Mautic's Twig templates rely on, so the rule stays off like in core.
|
||||
*/
|
||||
'no_alternative_syntax' => false,
|
||||
'header_comment' => [
|
||||
'header' => '',
|
||||
],
|
||||
'multiline_whitespace_before_semicolons' => true,
|
||||
'nullable_type_declaration_for_default_null_value' => false, // Enforces potential BC breaks.
|
||||
'no_superfluous_phpdoc_tags' => [
|
||||
'allow_mixed' => true,
|
||||
],
|
||||
])
|
||||
->setFinder($finder);
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,13 +7,15 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Catalog;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* Choice labels for Smart Link redirect enums: t("mautic.smartlinks.smart_links.redirect_<x>.<value>")
|
||||
* Choice labels for Smart Link redirect enums: t("mt3s.smart_links.smart_links.redirect_<x>.<value>")
|
||||
* gives "301 - Moved permanently (permanent)" style labels shared by the form and the list view.
|
||||
*/
|
||||
trait SmartLinkRedirectEnumHelper
|
||||
{
|
||||
/**
|
||||
* @return array<int|string, string> value (as string) => label
|
||||
* The choices of the form's redirect dropdowns and the list views: translated label => backing value.
|
||||
*
|
||||
* @return array<string, int|string> translated label => backing value of the enum case
|
||||
*/
|
||||
public static function getChoices(TranslatorInterface $translator): array
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ class RefreshStatsCommand extends Command
|
||||
|
||||
$rows = [];
|
||||
foreach ($programs as $program) {
|
||||
$id = (string) $program->getId();
|
||||
$id = (string) $program->getId();
|
||||
$rows[] = [
|
||||
$id,
|
||||
$program->getName(),
|
||||
@@ -132,4 +132,4 @@ class RefreshStatsCommand extends Command
|
||||
|
||||
return $done;
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
-39
@@ -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',
|
||||
],
|
||||
@@ -123,38 +123,38 @@ 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',
|
||||
'iconClass' => 'ri-links-line',
|
||||
'access' => [
|
||||
'mt3smarketingprogram:smart_links:viewown',
|
||||
'mt3smarketingprogram:smart_links:viewother',
|
||||
'mt3smarketingprogram:taxonomies:viewown',
|
||||
'mt3smarketingprogram:taxonomies:viewother',
|
||||
],
|
||||
'priority' => 4,
|
||||
'children' => [
|
||||
'mautic.smartlinks.menu.taxonomies' => [
|
||||
'id' => 'mautic_smartlinks_taxonomies',
|
||||
'route' => 'mautic_smartlinks_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',
|
||||
'iconClass' => 'ri-link',
|
||||
'access' => ['mt3smarketingprogram:smart_links:viewown', 'mt3smarketingprogram:smart_links:viewother'],
|
||||
// Top-level "Smart Links" menu: UTM Taxonomies above the Smart Links list. The two
|
||||
// domains (Marketing Program and Smart Links) stay separate menu groups.
|
||||
'mt3s.smart_links.menu.root' => [
|
||||
'id' => 'mt3s_smart_links',
|
||||
'route' => 'mt3s_smart_links_index',
|
||||
'iconClass' => 'ri-links-line',
|
||||
'access' => [
|
||||
'mt3smarketingprogram:smart_links:viewown',
|
||||
'mt3smarketingprogram:smart_links:viewother',
|
||||
'mt3smarketingprogram:taxonomies:viewown',
|
||||
'mt3smarketingprogram:taxonomies:viewother',
|
||||
],
|
||||
'priority' => 4,
|
||||
'children' => [
|
||||
'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,
|
||||
],
|
||||
'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,
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'services' => [
|
||||
'integrations' => [
|
||||
@@ -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' => '',
|
||||
|
||||
+9
-17
@@ -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.<entity>') to mautic.mt3smarketingprogram.model.<entity>:
|
||||
// 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);
|
||||
};
|
||||
@@ -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
|
||||
@@ -93,4 +93,4 @@ class AudienceController extends AbstractStandardFormController
|
||||
{
|
||||
return $this->batchDeleteStandard($request);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,4 +115,4 @@ class ItemTypesController extends AbstractFormController
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
@@ -79,7 +80,7 @@ class ProgramController extends AbstractStandardFormController
|
||||
}
|
||||
|
||||
if (!$this->checkActionPermission('view', $program)) {
|
||||
return $this->accessDenied();
|
||||
$this->throwAccessDenied();
|
||||
}
|
||||
|
||||
$base = $this->getPermissionBase();
|
||||
@@ -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;
|
||||
|
||||
@@ -4,13 +4,21 @@ declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\MT3SMarketingProgramBundle\Controller;
|
||||
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Mautic\CoreBundle\Controller\CommonController;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\SmartLink;
|
||||
use Mautic\CoreBundle\Factory\ModelFactory;
|
||||
use Mautic\CoreBundle\Helper\CoreParametersHelper;
|
||||
use Mautic\CoreBundle\Helper\UserHelper;
|
||||
use Mautic\CoreBundle\Security\Permissions\CorePermissions;
|
||||
use Mautic\CoreBundle\Service\FlashBag;
|
||||
use Mautic\CoreBundle\Translation\Translator;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Model\SmartLinkModel;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Contracts\Service\Attribute\Required;
|
||||
|
||||
/**
|
||||
* The public side of the Smart Links: https://{short_link_domain}/l/{slug}.
|
||||
@@ -24,12 +32,20 @@ use Symfony\Contracts\Service\Attribute\Required;
|
||||
*/
|
||||
class PublicController extends CommonController
|
||||
{
|
||||
private SmartLinkModel $smartLinkModel;
|
||||
|
||||
#[Required]
|
||||
public function autowirePublicController(SmartLinkModel $smartLinkModel): void
|
||||
{
|
||||
$this->smartLinkModel = $smartLinkModel;
|
||||
public function __construct(
|
||||
private readonly SmartLinkModel $smartLinkModel,
|
||||
private readonly LoggerInterface $logger,
|
||||
ManagerRegistry $doctrine,
|
||||
ModelFactory $modelFactory,
|
||||
UserHelper $userHelper,
|
||||
CoreParametersHelper $coreParametersHelper,
|
||||
EventDispatcherInterface $dispatcher,
|
||||
Translator $translator,
|
||||
FlashBag $flashBag,
|
||||
RequestStack $requestStack,
|
||||
CorePermissions $security,
|
||||
) {
|
||||
parent::__construct($doctrine, $modelFactory, $userHelper, $coreParametersHelper, $dispatcher, $translator, $flashBag, $requestStack, $security);
|
||||
}
|
||||
|
||||
public function goAction(Request $request, string $slug): Response
|
||||
@@ -64,7 +80,14 @@ class PublicController extends CommonController
|
||||
$this->smartLinkModel->recordHit($link, $request);
|
||||
} catch (\Throwable $e) {
|
||||
// Statistics must never block the redirect.
|
||||
error_log('Smart Link hit could not be recorded for slug "'.$slug.'": '.$e->getMessage().' in '.$e->getFile().':'.$e->getLine());
|
||||
$this->logger->error(
|
||||
'Smart Link hit could not be recorded for slug "{slug}": {message}',
|
||||
[
|
||||
'slug' => $slug,
|
||||
'message' => $e->getMessage(),
|
||||
'exception' => $e,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return new RedirectResponse($this->smartLinkModel->buildRedirectUrl($link), $link->getRedirectCode()->value);
|
||||
|
||||
@@ -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.<model name> (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';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,13 +103,18 @@ class SmartLinkController extends AbstractStandardFormController
|
||||
/**
|
||||
* Never save the slug of an existing link: it is immutable once created. The field is
|
||||
* disabled in the form, so nothing is submitted for it, this is a safety net.
|
||||
*
|
||||
* @param SmartLink $entity
|
||||
* @param string $action
|
||||
* @param int|null $objectId
|
||||
* @param bool $isClone
|
||||
*/
|
||||
protected function beforeEntitySave($entity, Form $form, $action, $objectId = null, $isClone = false): bool
|
||||
{
|
||||
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\Service\FlashBag::LEVEL_ERROR);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -121,6 +128,7 @@ class SmartLinkController extends AbstractStandardFormController
|
||||
* also displayed above the form of a link), and the number of hits of each link.
|
||||
*
|
||||
* @param array<string, mixed> $args
|
||||
* @param string $action
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
@@ -132,7 +140,7 @@ class SmartLinkController extends AbstractStandardFormController
|
||||
$model = $this->getModel($this->getModelName());
|
||||
\assert($model instanceof SmartLinkModel);
|
||||
|
||||
$args['viewParameters']['shortLinkDomain'] = $model->getShortLinkDomain();
|
||||
$args['viewParameters']['shortLinkDomain'] = $model->getShortLinkDomain();
|
||||
$args['viewParameters']['hitCounts'] = $model->getHitCounts();
|
||||
}
|
||||
|
||||
@@ -149,6 +157,8 @@ class SmartLinkController extends AbstractStandardFormController
|
||||
|
||||
/**
|
||||
* Smart Links don't have a detail page; after Save or Cancel go back to the list.
|
||||
*
|
||||
* @param string $action
|
||||
*/
|
||||
protected function getPostActionControllerAction($action): string
|
||||
{
|
||||
@@ -157,9 +167,11 @@ class SmartLinkController extends AbstractStandardFormController
|
||||
|
||||
/**
|
||||
* A saved Smart Link is never cloned: its slug is immutable, and a clone would need a new one.
|
||||
*
|
||||
* @param int|null $objectId
|
||||
*/
|
||||
public function cloneAction(Request $request, $objectId): Response
|
||||
{
|
||||
$this->accessDenied();
|
||||
$this->throwAccessDenied();
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -97,7 +97,7 @@ class TaskController extends AbstractStandardFormController
|
||||
*/
|
||||
public function editAction(Request $request, $objectId, $ignorePost = false): Response
|
||||
{
|
||||
$task = $this->getModel($this->getModelName())->getEntity((int) $objectId);
|
||||
$task = $this->getModel($this->getModelName())->getEntity((int) $objectId);
|
||||
$programId = $task instanceof Task ? $task->getProgram()?->getId() : null;
|
||||
$this->returnProgramId = $this->resolveReturnProgram($request, (string) (int) $objectId, $programId);
|
||||
|
||||
@@ -137,6 +137,10 @@ class TaskController extends AbstractStandardFormController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $action
|
||||
* @param int|null $objectId
|
||||
* @param bool $isClone
|
||||
*
|
||||
* @return object|null
|
||||
*/
|
||||
protected function getFormEntity($action, &$objectId = null, &$isClone = false)
|
||||
@@ -144,7 +148,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);
|
||||
}
|
||||
@@ -153,6 +157,13 @@ class TaskController extends AbstractStandardFormController
|
||||
return $entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Task $entity
|
||||
* @param string $action
|
||||
* @param mixed $pass
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function afterEntitySave($entity, Form $form, $action, $pass = null)
|
||||
{
|
||||
if ($entity instanceof Task) {
|
||||
@@ -167,6 +178,7 @@ class TaskController extends AbstractStandardFormController
|
||||
* was moved to another program, go to its new program. Otherwise keep core's default: the task list.
|
||||
*
|
||||
* @param array<string, mixed> $args
|
||||
* @param string $action
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
|
||||
@@ -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.<prefix>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.<model name>; every key of the feature lives under mautic.smartlinks.taxonomies.
|
||||
* Core builds mautic.<model name>; every key of the feature lives under mt3s.smart_links.taxonomies.
|
||||
*/
|
||||
protected function getTranslationBase(): string
|
||||
{
|
||||
return 'mautic.smartlinks.taxonomies';
|
||||
return 'mt3s.smart_links.taxonomies';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,6 +97,8 @@ class UtmTaxonomyController extends AbstractStandardFormController
|
||||
|
||||
/**
|
||||
* Taxonomies don't have a detail page; after Save or Cancel go back to the list.
|
||||
*
|
||||
* @param string $action
|
||||
*/
|
||||
protected function getPostActionControllerAction($action): string
|
||||
{
|
||||
@@ -113,9 +115,11 @@ class UtmTaxonomyController extends AbstractStandardFormController
|
||||
|
||||
/**
|
||||
* A saved taxonomy is never cloned: its name is unique, and a clone would collide on save.
|
||||
*
|
||||
* @param int|null $objectId
|
||||
*/
|
||||
public function cloneAction(Request $request, $objectId): Response
|
||||
{
|
||||
$this->accessDenied();
|
||||
$this->throwAccessDenied();
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
-15
@@ -141,16 +141,16 @@ class Audience extends FormEntity
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->stages = new ArrayCollection();
|
||||
$this->segments = new ArrayCollection();
|
||||
$this->stages = new ArrayCollection();
|
||||
$this->segments = new ArrayCollection();
|
||||
$this->programLinks = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->stages = new ArrayCollection();
|
||||
$this->segments = new ArrayCollection();
|
||||
$this->id = null;
|
||||
$this->stages = new ArrayCollection();
|
||||
$this->segments = new ArrayCollection();
|
||||
$this->programLinks = new ArrayCollection();
|
||||
|
||||
parent::__clone();
|
||||
@@ -171,21 +171,21 @@ class Audience extends FormEntity
|
||||
|
||||
// Mapped on the raw metadata: ClassMetadataBuilder::addField() forces every string to VARCHAR(191).
|
||||
$metadata->mapField([
|
||||
'fieldName' => 'audienceType',
|
||||
'fieldName' => 'audienceType',
|
||||
'columnName' => 'audience_type',
|
||||
'type' => Types::STRING,
|
||||
'length' => 30,
|
||||
'enumType' => AudienceType::class,
|
||||
'options' => ['default' => AudienceType::Persona->value],
|
||||
'type' => Types::STRING,
|
||||
'length' => 30,
|
||||
'enumType' => AudienceType::class,
|
||||
'options' => ['default' => AudienceType::Persona->value],
|
||||
]);
|
||||
|
||||
foreach ([
|
||||
'tagline' => 'tagline',
|
||||
'tagline' => 'tagline',
|
||||
'profileCriteria' => 'profile_criteria',
|
||||
'motivations' => 'motivations',
|
||||
'barriers' => 'barriers',
|
||||
'frustrations' => 'frustrations',
|
||||
'triggers' => 'triggers',
|
||||
'motivations' => 'motivations',
|
||||
'barriers' => 'barriers',
|
||||
'frustrations' => 'frustrations',
|
||||
'triggers' => 'triggers',
|
||||
] as $field => $column) {
|
||||
$metadata->mapField([
|
||||
'fieldName' => $field,
|
||||
|
||||
+10
-8
@@ -105,12 +105,12 @@ class Program extends FormEntity implements DateRangeInterface
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->objectives = new ArrayCollection();
|
||||
$this->descriptionItems = new ArrayCollection();
|
||||
$this->allocationItems = new ArrayCollection();
|
||||
$this->objectives = new ArrayCollection();
|
||||
$this->descriptionItems = new ArrayCollection();
|
||||
$this->allocationItems = new ArrayCollection();
|
||||
$this->audiences = new ArrayCollection();
|
||||
$this->stakeholders = new ArrayCollection();
|
||||
$this->tasks = new ArrayCollection();
|
||||
$this->stakeholders = new ArrayCollection();
|
||||
$this->tasks = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function __clone()
|
||||
@@ -163,8 +163,10 @@ class Program extends FormEntity implements DateRangeInterface
|
||||
->setCustomRepositoryClass(ProgramRepository::class)
|
||||
->addIndex(['status'], 'program_status');
|
||||
|
||||
// id and name; no description column (replaced by description items).
|
||||
$builder->addIdColumns('name', false);
|
||||
// id and name; no description column (replaced by description items). The false is
|
||||
// core's own way to skip the column (addIdColumns checks it for truthiness); core's
|
||||
// @param string docblock just doesn't mention it.
|
||||
$builder->addIdColumns('name', false); // @phpstan-ignore argument.type (false is core's own way to skip the column; its @param string docblock doesn't mention it)
|
||||
|
||||
// Mapped on the raw metadata: ClassMetadataBuilder::addField() forces every string to VARCHAR(191).
|
||||
$metadata->mapField([
|
||||
@@ -468,7 +470,7 @@ class Program extends FormEntity implements DateRangeInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @template T of ProgramObjective|ProgramDescriptionItem|ProgramAllocationItem|Audience|ProgramStakeholder
|
||||
* @template T of ProgramObjective|ProgramDescriptionItem|ProgramAllocationItem|ProgramAudience|ProgramStakeholder
|
||||
*
|
||||
* @param Collection<int, T> $collection
|
||||
*
|
||||
|
||||
@@ -49,7 +49,7 @@ class ProgramAllocationItem
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->id = null;
|
||||
$this->program = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class ProgramAudience
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->id = null;
|
||||
$this->program = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,4 +15,4 @@ class ProgramAudienceRepository extends CommonRepository
|
||||
{
|
||||
return 'pa';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class ProgramDescriptionItem
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->id = null;
|
||||
$this->program = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class ProgramObjective
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->id = null;
|
||||
$this->program = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class ProgramStakeholder
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->id = null;
|
||||
$this->id = null;
|
||||
$this->program = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,10 @@ enum ProgramStatus: string
|
||||
public function getLabelClass(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Active => 'label-success',
|
||||
self::Completed => 'label-info',
|
||||
self::Paused => 'label-warning',
|
||||
self::Archived => 'label-default',
|
||||
self::Active => 'label-success',
|
||||
self::Completed => 'label-info',
|
||||
self::Paused => 'label-warning',
|
||||
self::Archived => 'label-default',
|
||||
self::Draft, self::Planned => 'label-primary',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,13 @@ class SmartLinkRepository extends CommonRepository
|
||||
$this->getTableAlias().'.destinationUrl',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Hits column of the list sorts by the number of hits of each link: the virtual
|
||||
* "hitCount" order by maps to the HIDDEN hitCount scalar of the list query. Everything
|
||||
* else falls back to core's column handling.
|
||||
*
|
||||
* @param array<string, mixed> $args
|
||||
*/
|
||||
protected function buildOrderByClause($q, array $args): void
|
||||
{
|
||||
@@ -92,6 +95,7 @@ class SmartLinkRepository extends CommonRepository
|
||||
|
||||
parent::buildOrderByClause($q, $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array{0: string, 1: string}>
|
||||
*/
|
||||
|
||||
@@ -19,9 +19,10 @@ class StakeholderRepository extends CommonRepository
|
||||
}
|
||||
|
||||
/**
|
||||
* The list's search box matches the name, email, role and type.
|
||||
* The list's search box matches the name, email, role and type. Core passes the filter
|
||||
* as an object with ->string and ->strict (its own docblock), not an array.
|
||||
*
|
||||
* @param array<int, mixed> $filter
|
||||
* @param \stdClass $filter
|
||||
*
|
||||
* @return array<int, mixed>
|
||||
*/
|
||||
|
||||
@@ -51,12 +51,12 @@ class TaskDependency
|
||||
->build();
|
||||
|
||||
$metadata->mapField([
|
||||
'fieldName' => 'dependencyType',
|
||||
'fieldName' => 'dependencyType',
|
||||
'columnName' => 'dependency_type',
|
||||
'type' => Types::STRING,
|
||||
'length' => 20,
|
||||
'enumType' => DependencyType::class,
|
||||
'options' => ['default' => DependencyType::EndToStart->value],
|
||||
'type' => Types::STRING,
|
||||
'length' => 20,
|
||||
'enumType' => DependencyType::class,
|
||||
'options' => ['default' => DependencyType::EndToStart->value],
|
||||
]);
|
||||
|
||||
$builder->createField('position', Types::INTEGER)
|
||||
|
||||
+1
-1
@@ -4,9 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\MT3SMarketingProgramBundle\Entity;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping\ClassMetadata as OrmClassMetadata;
|
||||
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class UtmTaxonomy extends FormEntity
|
||||
|
||||
// Mapped on the raw metadata: ClassMetadataBuilder::addField() forces VARCHAR(191) on strings.
|
||||
$metadata->mapField([
|
||||
'fieldName' => 'parameters',
|
||||
'fieldName' => 'parameters',
|
||||
'columnName' => 'parameters',
|
||||
'type' => Types::JSON,
|
||||
]);
|
||||
@@ -140,4 +140,4 @@ class UtmTaxonomy extends FormEntity
|
||||
{
|
||||
return array_keys($this->parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,4 +60,4 @@ class UtmTaxonomyRepository extends CommonRepository
|
||||
[$this->getTableAlias().'.name', 'ASC'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,4 +29,4 @@ final class MT3SMarketingProgramEvents
|
||||
|
||||
/** After a program was removed from the database. */
|
||||
public const PROGRAM_DELETED = 'mt3s.marketing_program.deleted';
|
||||
}
|
||||
}
|
||||
@@ -27,4 +27,4 @@ final class ProgramEvent extends Event
|
||||
{
|
||||
return $this->isNew;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,4 +33,4 @@ final class SmartLinksConfigSubscriber implements EventSubscriberInterface
|
||||
'parameters' => $event->getParametersFromConfig('MT3SMarketingProgramBundle'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>>
|
||||
|
||||
@@ -14,8 +14,6 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
* the Email form (EmailType) and the Focus Item form (FocusType), so this covers both.
|
||||
*
|
||||
* Registered as `form.type_extension` by autoconfiguration (Config/services.php).
|
||||
*
|
||||
* @extends AbstractTypeExtension<mixed>
|
||||
*/
|
||||
final class UtmTagsTypeExtension extends AbstractTypeExtension
|
||||
{
|
||||
|
||||
@@ -28,8 +28,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
* fixed type (persona, ICP, …), the segments (purely informational), then the persona attributes
|
||||
* the admin switched on in Settings > Configuration > Program Settings (AudienceAttributes): one
|
||||
* toggle per attribute, so a b2b install and a b2c install define their personas differently.
|
||||
*
|
||||
* @extends AbstractType<Audience>
|
||||
*/
|
||||
class AudienceType extends AbstractType
|
||||
{
|
||||
@@ -167,7 +165,7 @@ class AudienceType extends AbstractType
|
||||
|
||||
if (in_array('stages', $enabled, true)) {
|
||||
$builder->add('stages', EntityType::class, [
|
||||
'label' => 'mt3s.marketing_program.audience.field.stages',
|
||||
'label' => 'mt3s.marketing_program.audience.field.stages',
|
||||
'label_attr' => ['class' => 'control-label'],
|
||||
'attr' => ['class' => 'form-control'],
|
||||
'class' => Stage::class,
|
||||
@@ -210,4 +208,4 @@ class AudienceType extends AbstractType
|
||||
{
|
||||
return 'mt3s_marketing_program_audience';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
|
||||
|
||||
use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Model\StakeholderModel;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Service\CurrencyProvider;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Service\AudienceAttributes;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Service\CurrencyProvider;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
|
||||
@@ -24,8 +24,6 @@ use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
*
|
||||
* The item type lists moved to their own page under Programs (ItemTypesController, Programs >
|
||||
* Item types).
|
||||
*
|
||||
* @extends AbstractType<array<string, mixed>>
|
||||
*/
|
||||
class ConfigType extends AbstractType
|
||||
{
|
||||
|
||||
@@ -25,8 +25,6 @@ use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
*
|
||||
* The key is hidden. It is generated when the type is created and never changes, so that renaming a
|
||||
* type doesn't affect the items that use it.
|
||||
*
|
||||
* @extends AbstractType<array<string, mixed>>
|
||||
*/
|
||||
class ItemTypeConfigType extends AbstractType
|
||||
{
|
||||
|
||||
@@ -17,8 +17,6 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
* an audience's decision roles and tones. Each child is one of ItemTypeProvider::PARAMETERS,
|
||||
* keyed exactly by the local.php parameter that stores the list, so saving is a straight merge
|
||||
* into the local configuration.
|
||||
*
|
||||
* @extends AbstractType<array<string, mixed>>
|
||||
*/
|
||||
class ItemTypesType extends AbstractType
|
||||
{
|
||||
@@ -29,15 +27,15 @@ class ItemTypesType extends AbstractType
|
||||
$withIcon = !in_array($kind, [ItemTypeProvider::KIND_AUDIENCE_DECISION_ROLE, ItemTypeProvider::KIND_AUDIENCE_TONE], true);
|
||||
|
||||
$builder->add($parameter, CollectionType::class, [
|
||||
'label' => false,
|
||||
'entry_type' => ItemTypeConfigType::class,
|
||||
'entry_options' => ['label' => false, 'with_icon' => $withIcon],
|
||||
'label' => false,
|
||||
'entry_type' => ItemTypeConfigType::class,
|
||||
'entry_options' => ['label' => false, 'with_icon' => $withIcon],
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
'prototype' => true,
|
||||
'prototype_name' => '__type__',
|
||||
'required' => false,
|
||||
'error_bubbling' => false,
|
||||
'prototype_name' => '__type__',
|
||||
'required' => false,
|
||||
'error_bubbling' => false,
|
||||
]);
|
||||
|
||||
// Stored as a clean list (0..n-1, empty texts dropped), in the order shown on the page.
|
||||
@@ -55,4 +53,4 @@ class ItemTypesType extends AbstractType
|
||||
// The POST data keys: mt3s_marketing_program_item_types[<parameter>][<index>][…].
|
||||
return 'mt3s_marketing_program_item_types';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
* real cost (both in the general currency). Works like ProgramDescriptionItemType (type description shown
|
||||
* under the dropdown and its pictogram next to it, hidden position kept in display order by
|
||||
* Assets/js/mt3s-mp-program.js).
|
||||
*
|
||||
* @extends AbstractType<ProgramAllocationItem>
|
||||
*/
|
||||
class ProgramAllocationItemType extends AbstractType
|
||||
{
|
||||
|
||||
@@ -20,8 +20,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
* One row of the audiences collection in ProgramType: an audience of the global directory (only the
|
||||
* active ones are offered), the audience's priority in this plan, and possibly a program-specific
|
||||
* message. The position field is hidden and kept in display order by Assets/js/mt3s-mp-program.js.
|
||||
*
|
||||
* @extends AbstractType<ProgramAudience>
|
||||
*/
|
||||
class ProgramAudienceType extends AbstractType
|
||||
{
|
||||
@@ -73,4 +71,4 @@ class ProgramAudienceType extends AbstractType
|
||||
{
|
||||
return 'mt3s_marketing_program_program_audience';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
* types set up in Settings > Configuration > Program; each option carries the type's description, which
|
||||
* Assets/js/mt3s-mp-program.js shows under the dropdown. The position field is hidden and kept in display order by
|
||||
* mt3s-mp-program.js.
|
||||
*
|
||||
* @extends AbstractType<ProgramDescriptionItem>
|
||||
*/
|
||||
class ProgramDescriptionItemType extends AbstractType
|
||||
{
|
||||
|
||||
@@ -20,8 +20,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
* One row of the objectives collection in ProgramType: type, title, priority, description and the achieved
|
||||
* flag. Works like ProgramDescriptionItemType (type description shown under the dropdown and its pictogram
|
||||
* next to it, hidden position kept in display order by Assets/js/mt3s-mp-program.js).
|
||||
*
|
||||
* @extends AbstractType<ProgramObjective>
|
||||
*/
|
||||
class ProgramObjectiveType extends AbstractType
|
||||
{
|
||||
@@ -58,7 +56,7 @@ class ProgramObjectiveType extends AbstractType
|
||||
'label' => 'mt3s.marketing_program.objective.field.priority',
|
||||
'label_attr' => ['class' => 'control-label'],
|
||||
'invalid_message' => 'mt3s.marketing_program.objective.priority.range',
|
||||
'attr' => [
|
||||
'attr' => [
|
||||
'class' => 'form-control',
|
||||
'min' => ProgramObjective::PRIORITY_MIN,
|
||||
'max' => ProgramObjective::PRIORITY_MAX,
|
||||
|
||||
@@ -18,8 +18,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
* One row of the stakeholders collection in ProgramType: a stakeholder of the global directory (only the
|
||||
* active ones are offered) and the stakeholder's role in this plan. The position field is hidden and
|
||||
* kept in display order by Assets/js/mt3s-mp-program.js.
|
||||
*
|
||||
* @extends AbstractType<ProgramStakeholder>
|
||||
*/
|
||||
class ProgramStakeholderType extends AbstractType
|
||||
{
|
||||
|
||||
@@ -16,8 +16,6 @@ use Mautic\UserBundle\Form\Type\UserListType;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramStatus;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Service\CurrencyProvider;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Form\Type\ProgramAudienceType;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Form\Type\ProgramStakeholderType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||
@@ -27,9 +25,6 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* @extends AbstractType<Program>
|
||||
*/
|
||||
class ProgramType extends AbstractType
|
||||
{
|
||||
public function __construct(
|
||||
@@ -81,15 +76,15 @@ class ProgramType extends AbstractType
|
||||
// The Audiences tab's links to the global directory. by_reference false: Symfony calls
|
||||
// Program::addAudience()/removeAudience().
|
||||
$builder->add('audiences', CollectionType::class, [
|
||||
'label' => 'mt3s.marketing_program.field.audiences',
|
||||
'entry_type' => ProgramAudienceType::class,
|
||||
'entry_options' => ['label' => false],
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
'label' => 'mt3s.marketing_program.field.audiences',
|
||||
'entry_type' => ProgramAudienceType::class,
|
||||
'entry_options' => ['label' => false],
|
||||
'allow_add' => true,
|
||||
'allow_delete' => true,
|
||||
'by_reference' => false,
|
||||
'prototype' => true,
|
||||
'prototype_name' => '__audience__',
|
||||
'required' => false,
|
||||
'prototype' => true,
|
||||
'prototype_name' => '__audience__',
|
||||
'required' => false,
|
||||
]);
|
||||
|
||||
// The Stakeholders tab's links to the global directory. by_reference false: Symfony calls
|
||||
@@ -110,7 +105,7 @@ class ProgramType extends AbstractType
|
||||
'label' => 'mt3s.marketing_program.field.version',
|
||||
'label_attr' => ['class' => 'control-label'],
|
||||
'invalid_message' => 'mt3s.marketing_program.version.range',
|
||||
'attr' => [
|
||||
'attr' => [
|
||||
'class' => 'form-control',
|
||||
'min' => Program::VERSION_MIN,
|
||||
'max' => Program::VERSION_MAX,
|
||||
|
||||
+28
-31
@@ -48,8 +48,6 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
* data-show-on switcher shows the fieldset of the chosen taxonomy; the values posted for
|
||||
* the others are dropped on submit. A stored value outside the list stays selectable,
|
||||
* labelled "(not in taxonomy)", so an old link is still editable.
|
||||
*
|
||||
* @extends AbstractType<SmartLink>
|
||||
*/
|
||||
final class SmartLinkType extends AbstractType
|
||||
{
|
||||
@@ -84,22 +82,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 +105,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 +148,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 ------------------------------------------------------------
|
||||
@@ -183,7 +181,6 @@ final class SmartLinkType extends AbstractType
|
||||
$this->buildTaxonomyFieldOptions($taxonomy, $key, $smartLink)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// The stored values (parameter key => value) feed the fieldset children
|
||||
@@ -322,7 +319,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 +345,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 +355,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'],
|
||||
];
|
||||
}
|
||||
@@ -506,20 +503,20 @@ final class SmartLinkType extends AbstractType
|
||||
private function buildMauticDestinationChoices(SmartLink $smartLink): array
|
||||
{
|
||||
$choices = [];
|
||||
$values = [];
|
||||
$values = [];
|
||||
|
||||
$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;
|
||||
$values[] = $value;
|
||||
$value = 'page:'.$page->getId();
|
||||
$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;
|
||||
$values[] = $value;
|
||||
$value = 'form:'.$form->getId();
|
||||
$choices['mt3s.smart_links.smart_links.destination.forms'][$form->getName()] = $value;
|
||||
$values[] = $value;
|
||||
}
|
||||
|
||||
// A stored destination that is no longer published stays selectable, so an old link
|
||||
@@ -528,8 +525,8 @@ final class SmartLinkType extends AbstractType
|
||||
// back to index-based values for every option.
|
||||
$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;
|
||||
$label = $smartLink->getPage()?->getTitle() ?? $smartLink->getForm()?->getName() ?? '';
|
||||
$choices['mt3s.smart_links.smart_links.destination.unpublished'][$label] = $current;
|
||||
}
|
||||
|
||||
return $choices;
|
||||
|
||||
@@ -14,13 +14,14 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
* The single "Smart Links Settings" tab of Settings > Configuration: the general UTM rules and
|
||||
* the short link domain (section "UTM Settings"), the catalog and custom parameters (section
|
||||
* "Parameters"). Each child is a local.php parameter.
|
||||
*
|
||||
* @extends AbstractType<array<string, mixed>>
|
||||
*/
|
||||
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 +34,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',
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -47,4 +48,4 @@ final class SmartLinksConfigType extends AbstractType
|
||||
// The Configuration tab title key: mautic.config.tab.smartlinksconfig.
|
||||
return 'smartlinksconfig';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,9 +16,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* The `smartlinks_utm_config` parameter: general settings, catalog parameters and custom parameters.
|
||||
*
|
||||
* @extends AbstractType<array<string, mixed>>
|
||||
* The `mt3s_smart_links_utm_config` parameter: general settings, catalog parameters and custom parameters.
|
||||
*/
|
||||
final class SmartlinksSettingsType extends AbstractType
|
||||
{
|
||||
@@ -31,23 +29,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 +83,6 @@ final class SmartlinksSettingsType extends AbstractType
|
||||
|
||||
public function getBlockPrefix(): string
|
||||
{
|
||||
return 'smartlinks_utm_settings';
|
||||
return 'mt3s_smart_links_utm_settings';
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
|
||||
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider;
|
||||
use Mautic\CoreBundle\Form\Type\FormButtonsType;
|
||||
use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EmailType;
|
||||
@@ -18,8 +18,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* The create and edit form of a stakeholder of the global directory (Programs > Stakeholders).
|
||||
*
|
||||
* @extends AbstractType<Stakeholder>
|
||||
*/
|
||||
class StakeholderType extends AbstractType
|
||||
{
|
||||
|
||||
@@ -20,8 +20,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
* One row of the dependencies collection in TaskType: the task this one depends on, and the type of
|
||||
* the relation. Only the tasks of the same program are offered; cycles and self-edges are refused by
|
||||
* ValidTaskDependency.
|
||||
*
|
||||
* @extends AbstractType<TaskDependency>
|
||||
*/
|
||||
class TaskDependencyType extends AbstractType
|
||||
{
|
||||
|
||||
@@ -19,8 +19,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
/**
|
||||
* One row of the RACI collection in TaskType: a role (R/A/C/I) and the stakeholders carrying it.
|
||||
* The stakeholders are picked from the program's assigned stakeholders; several may share a role.
|
||||
*
|
||||
* @extends AbstractType<TaskRaci>
|
||||
*/
|
||||
class TaskRaciType extends AbstractType
|
||||
{
|
||||
|
||||
@@ -30,8 +30,6 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
* Kind rules: a milestone's end date is enslaved to its start date (the entity's setTaskKind copies
|
||||
* the start onto the end, and the TaskDates validator keeps it in step); a phase has no status
|
||||
* field — its state comes from its tasks.
|
||||
*
|
||||
* @extends AbstractType<Task>
|
||||
*/
|
||||
class TaskType extends AbstractType
|
||||
{
|
||||
@@ -45,7 +43,7 @@ class TaskType extends AbstractType
|
||||
$builder->addEventSubscriber(new CleanFormSubscriber(['description' => 'strict_html']));
|
||||
|
||||
/** @var Task $task */
|
||||
$task = $options['data'];
|
||||
$task = $options['data'];
|
||||
$program = $task->getProgram();
|
||||
|
||||
$kind = ItemTypeProvider::KIND_TASK;
|
||||
|
||||
@@ -29,8 +29,6 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* One parameter row: a catalog entry (option `definition`) or a custom parameter (`definition` = null).
|
||||
*
|
||||
* @extends AbstractType<array<string, mixed>>
|
||||
*/
|
||||
final class UtmParameterType extends AbstractType
|
||||
{
|
||||
@@ -48,9 +46,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 +60,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
|
||||
@@ -137,15 +135,15 @@ final class UtmParameterType extends AbstractType
|
||||
|
||||
$view->vars['utm_custom'] = null === $definition;
|
||||
$view->vars['utm_key'] = $definition?->key;
|
||||
$view->vars['utm_group'] = $definition?->group ?? UtmParameterCatalog::GROUP_CUSTOM;
|
||||
$view->vars['utm_group'] = $definition->group ?? UtmParameterCatalog::GROUP_CUSTOM;
|
||||
$view->vars['utm_description_key'] = $definition?->getDescriptionKey();
|
||||
$view->vars['utm_auto_generated'] = $definition?->autoGenerated ?? false;
|
||||
$view->vars['utm_auto_generated'] = $definition->autoGenerated ?? false;
|
||||
$view->vars['utm_suggestions'] = array_map(
|
||||
fn (string $value): array => [
|
||||
'value' => $value,
|
||||
'label' => $this->translator->trans(UtmParameterDefinition::getSuggestionLabelKey($value)),
|
||||
],
|
||||
$definition?->suggestions ?? []
|
||||
$definition->suggestions ?? []
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
|
||||
use Mautic\CoreBundle\Form\Type\FormButtonsType;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Catalog\UtmParameterMode;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\UtmTaxonomy;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Form\Validator\UtmSettingsValidator;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Form\Validator\UtmTaxonomyValidator;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Service\UtmConfigurationProvider;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
@@ -35,8 +34,6 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
* selection -- nothing can be typed), and a `free` parameter gets its own editable value
|
||||
* list here (one `value` or `value;Label` per line): a Smart Link using this taxonomy picks
|
||||
* a value from it instead of typing freely.
|
||||
*
|
||||
* @extends AbstractType<UtmTaxonomy>
|
||||
*/
|
||||
final class UtmTaxonomyType extends AbstractType
|
||||
{
|
||||
@@ -49,26 +46,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 +111,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 +133,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',
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -211,7 +208,7 @@ final class UtmTaxonomyType extends AbstractType
|
||||
* free ones (a `value;Label` line when the label differs from the value).
|
||||
*
|
||||
* @param array<string, array<string, string>> $dropdowns
|
||||
* @param list<string> $frees
|
||||
* @param list<string> $frees
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
@@ -268,7 +265,7 @@ final class UtmTaxonomyType extends AbstractType
|
||||
* textarea lines become rows (labels default to the value); empty lists drop the key.
|
||||
*
|
||||
* @param array<string, array<string, string>> $dropdowns
|
||||
* @param list<string> $frees
|
||||
* @param list<string> $frees
|
||||
*
|
||||
* @return array<string, list<array{value: string, label: string}>>
|
||||
*/
|
||||
@@ -356,7 +353,7 @@ final class UtmTaxonomyType extends AbstractType
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormInterface|FormBuilderInterface $form
|
||||
* @param FormInterface|FormBuilderInterface $form
|
||||
* @param list<array{0: string, 1: array<string, string>}> $errors
|
||||
*/
|
||||
private function addErrorsOn(object $form, array $errors): void
|
||||
@@ -365,4 +362,4 @@ final class UtmTaxonomyType extends AbstractType
|
||||
$form->addError(new FormError($message, null, $parameters));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,39 +16,37 @@ use Symfony\Component\Validator\Constraints\Regex;
|
||||
|
||||
/**
|
||||
* One allowed value of a `dropdown` parameter.
|
||||
*
|
||||
* @extends AbstractType<array<string, mixed>>
|
||||
*/
|
||||
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) {
|
||||
|
||||
@@ -9,8 +9,8 @@ use Mautic\PageBundle\Entity\Page;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Catalog\SmartLinkRedirectType;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Catalog\UtmParameterMode;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\UtmTaxonomy;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Service\UtmConfigurationProvider;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Model\SmartLinkModel;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Service\UtmConfigurationProvider;
|
||||
|
||||
/**
|
||||
* Business rules of the Smart Link form. The form type calls these methods from Callback
|
||||
@@ -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,
|
||||
@@ -70,4 +70,4 @@ final class UtmTaxonomyValidator
|
||||
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
+1
-1
@@ -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;
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Since 0.10.0 objectives have a type, the key of an objective type set up in Settings >
|
||||
* Configuration > Plan Settings (parameter plan_objective_types). Adds initiative_objectives.type for
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Since 0.10.1 objectives have a priority, a whole number from 1 (highest) to 99 (lowest). Adds
|
||||
* initiative_objectives.priority for installs created before 0.10.1: NOT NULL with the default 1, and the
|
||||
@@ -29,7 +30,7 @@ class Version_0_10_1 extends AbstractMigration
|
||||
|
||||
if (!$table->hasColumn('priority')) {
|
||||
$this->addSql(sprintf(
|
||||
"ALTER TABLE %s ADD priority INT NOT NULL DEFAULT %d",
|
||||
'ALTER TABLE %s ADD priority INT NOT NULL DEFAULT %d',
|
||||
$objectives,
|
||||
1
|
||||
));
|
||||
|
||||
@@ -9,6 +9,7 @@ use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\AudienceType as AudienceTypeEnum;
|
||||
|
||||
/**
|
||||
* Since 0.11.0 a plan has audiences (table initiative_audiences, initiative_audiences_stages before 0.15.0) with any
|
||||
* number of Mautic stages (join table initiative_audiences_stages). Creates both tables for installs created
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience;
|
||||
|
||||
/**
|
||||
* Since 0.14.0 audiences are a global directory (Planning > Audiences, called Targets before 0.15.0),
|
||||
* like stakeholders:
|
||||
@@ -46,7 +47,7 @@ class Version_0_14_0 extends AbstractMigration
|
||||
}
|
||||
|
||||
[$directory, $links] = $names;
|
||||
$oldNaming = 'initiative_audiences' === $directory;
|
||||
$oldNaming = 'initiative_audiences' === $directory;
|
||||
|
||||
$table = $schema->getTable($directory);
|
||||
$shared = fn (string $column): bool => $table->hasColumn($this->concatPrefix($column));
|
||||
@@ -201,4 +202,4 @@ class Version_0_14_0 extends AbstractMigration
|
||||
// mapping, foreign keys included — nothing to repair first.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience;
|
||||
|
||||
/**
|
||||
* Historical migration (from 0.15.0, when the bundle was still PlanBundle): it renamed "targets"
|
||||
* to "audiences" — plan_targets became plan_audiences (its target_type column audience_type),
|
||||
|
||||
@@ -34,20 +34,20 @@ class Version_0_16_0 extends AbstractMigration
|
||||
* needed, but one rename per line keeps half-applied states recoverable).
|
||||
*/
|
||||
private const TABLES = [
|
||||
'plans' => 'initiatives',
|
||||
'plan_objectives' => 'initiative_objectives',
|
||||
'plan_description_items' => 'initiative_description_items',
|
||||
'plan_allocation_items' => 'initiative_allocation_items',
|
||||
'plan_tasks' => 'initiative_tasks',
|
||||
'plan_task_dependencies' => 'initiative_task_dependencies',
|
||||
'plan_task_raci' => 'initiative_task_raci',
|
||||
'plans' => 'initiatives',
|
||||
'plan_objectives' => 'initiative_objectives',
|
||||
'plan_description_items' => 'initiative_description_items',
|
||||
'plan_allocation_items' => 'initiative_allocation_items',
|
||||
'plan_tasks' => 'initiative_tasks',
|
||||
'plan_task_dependencies' => 'initiative_task_dependencies',
|
||||
'plan_task_raci' => 'initiative_task_raci',
|
||||
'plan_task_raci_stakeholders' => 'initiative_task_raci_stakeholders',
|
||||
'plan_stakeholders' => 'initiative_stakeholders',
|
||||
'plan_stakeholders_plan' => 'initiative_stakeholders_initiative',
|
||||
'plan_audiences' => 'initiative_audiences',
|
||||
'plan_audiences_plan' => 'initiative_audiences_initiative',
|
||||
'plan_audiences_segments' => 'initiative_audiences_segments',
|
||||
'plan_audiences_stages' => 'initiative_audiences_stages',
|
||||
'plan_stakeholders' => 'initiative_stakeholders',
|
||||
'plan_stakeholders_plan' => 'initiative_stakeholders_initiative',
|
||||
'plan_audiences' => 'initiative_audiences',
|
||||
'plan_audiences_plan' => 'initiative_audiences_initiative',
|
||||
'plan_audiences_segments' => 'initiative_audiences_segments',
|
||||
'plan_audiences_stages' => 'initiative_audiences_stages',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,12 +43,12 @@ class Version_0_17_0 extends AbstractMigration
|
||||
'initiative_description_items' => 'mt3s_mp_program_description_items',
|
||||
'initiative_allocation_items' => 'mt3s_mp_program_allocation_items',
|
||||
'initiative_tasks' => 'mt3s_mp_program_tasks',
|
||||
'initiative_task_dependencies' => 'mt3s_mp_program_task_dependencies',
|
||||
'initiative_task_dependencies' => 'mt3s_mp_program_task_dependencies',
|
||||
'initiative_task_raci' => 'mt3s_mp_program_task_raci',
|
||||
'initiative_task_raci_stakeholders' => 'mt3s_mp_program_task_raci_stakeholders',
|
||||
'initiative_stakeholders' => 'mt3s_mp_program_stakeholders',
|
||||
'initiative_stakeholders_initiative' => 'mt3s_mp_program_stakeholders_program',
|
||||
'initiative_audiences' => 'mt3s_mp_program_audiences',
|
||||
'initiative_audiences' => 'mt3s_mp_program_audiences',
|
||||
'initiative_audiences_initiative' => 'mt3s_mp_program_audiences_program',
|
||||
'initiative_audiences_segments' => 'mt3s_mp_program_audiences_segments',
|
||||
'initiative_audiences_stages' => 'mt3s_mp_program_audiences_stages',
|
||||
@@ -215,4 +215,4 @@ class Version_0_17_0 extends AbstractMigration
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Brings the plans table in line with the entity mapping.
|
||||
*
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Adds plans.version and the initiative_objectives table to installs created before 0.3.0.
|
||||
*
|
||||
|
||||
@@ -76,7 +76,7 @@ class Version_0_4_0 extends AbstractMigration
|
||||
}
|
||||
}
|
||||
|
||||
throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for '.'initiative_tasks'.'.');
|
||||
throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for initiative_tasks.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
|
||||
/**
|
||||
* For installs created before 0.6.0:
|
||||
* - creates initiative_description_items (and its foreign key to plans, ON DELETE CASCADE);
|
||||
@@ -80,6 +81,6 @@ class Version_0_6_0 extends AbstractMigration
|
||||
}
|
||||
}
|
||||
|
||||
throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for '.'initiative_description_items'.'.');
|
||||
throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for initiative_description_items.');
|
||||
}
|
||||
}
|
||||
@@ -97,4 +97,4 @@ class Version_0_6_0_SmartLinks extends AbstractMigration
|
||||
|
||||
return array_values($missing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\ORM\Tools\SchemaTool;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Creates initiative_allocation_items (and its foreign key to plans, ON DELETE CASCADE) for installs created
|
||||
* before 0.7.0. Each step runs only if needed. As in Version_0_4_0, only the CREATE TABLE statement for
|
||||
@@ -71,6 +72,6 @@ class Version_0_7_0 extends AbstractMigration
|
||||
}
|
||||
}
|
||||
|
||||
throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for '.'initiative_allocation_items'.'.');
|
||||
throw new \RuntimeException('SchemaTool returned no CREATE TABLE statement for initiative_allocation_items.');
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace MauticPlugin\MT3SMarketingProgramBundle\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Mautic\IntegrationsBundle\Migration\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Since 0.8.0 every amount is in one general currency (Settings > Configuration > Plan Settings, parameter
|
||||
* program_currency), so the per-record currency columns are dropped: plans.currency,
|
||||
@@ -18,7 +19,7 @@ class Version_0_8_0 extends AbstractMigration
|
||||
* Table => columns to drop.
|
||||
*/
|
||||
private const COLUMNS = [
|
||||
'initiatives' => ['currency'],
|
||||
'initiatives' => ['currency'],
|
||||
'initiative_allocation_items' => ['planned_currency', 'real_currency'],
|
||||
];
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -60,4 +60,4 @@ class AudienceModel extends FormModel
|
||||
|
||||
return $formFactory->create(AudienceType::class, $entity, $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Program>
|
||||
*/
|
||||
class ProgramModel extends FormModel
|
||||
|
||||
@@ -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<SmartLink>
|
||||
*/
|
||||
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;
|
||||
@@ -129,7 +129,7 @@ class SmartLinkModel extends FormModel
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $utmParameters
|
||||
* @param array<string, string|null> $utmParameters values may be null (an empty form field); they are dropped
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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<Task>
|
||||
*/
|
||||
|
||||
@@ -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<UtmTaxonomy>
|
||||
*/
|
||||
class UtmTaxonomyModel extends FormModel
|
||||
{
|
||||
public const MODEL_NAME = 'smartlinks.utm_taxonomy';
|
||||
public const MODEL_NAME = 'mt3smarketingprogram.utm_taxonomy';
|
||||
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
@@ -146,4 +146,4 @@ class UtmTaxonomyModel extends FormModel
|
||||
{
|
||||
return $this->getRepository()->nameExists($name, $ignoreId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 %}
|
||||
<div class="text-muted small pb-md">{{ 'mautic.smartlinks.settings.description'|trans }}</div>
|
||||
{% set utm = form.children.mt3s_smart_links_utm_config %}
|
||||
{% set links = form.children.mt3s_smart_links_config %}
|
||||
<div class="text-muted small pb-md">{{ 'mt3s.smart_links.settings.description'|trans }}</div>
|
||||
{{ form_errors(utm) }}
|
||||
{{ form_errors(links) }}
|
||||
|
||||
<div class="smartlinks-utm-config">
|
||||
<h4 class="fw-sb mb-xs">{{ 'mautic.smartlinks.config.section.utm_settings'|trans }}</h4>
|
||||
<h4 class="fw-sb mb-xs">{{ 'mt3s.smart_links.config.section.utm_settings'|trans }}</h4>
|
||||
<div class="panel panel-default mb-md">
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
@@ -21,11 +21,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="fw-sb mt-lg mb-xs">{{ 'mautic.smartlinks.config.section.parameters'|trans }}</h4>
|
||||
<p class="text-muted small">{{ 'mautic.smartlinks.config.description'|trans }}</p>
|
||||
<h4 class="fw-sb mt-lg mb-xs">{{ 'mt3s.smart_links.config.section.parameters'|trans }}</h4>
|
||||
<p class="text-muted small">{{ 'mt3s.smart_links.config.description'|trans }}</p>
|
||||
|
||||
{% for group in ['standard', 'platform'] %}
|
||||
<h5 class="fw-sb mt-md mb-sm">{{ ('mautic.smartlinks.config.group.' ~ group)|trans }}</h5>
|
||||
<h5 class="fw-sb mt-md mb-sm">{{ ('mt3s.smart_links.config.group.' ~ group)|trans }}</h5>
|
||||
<div class="panel-group mb-md">
|
||||
{% for parameter in utm.children.parameters|filter(p => p.vars.utm_group == group) %}
|
||||
{{ form_widget(parameter) }}
|
||||
@@ -34,7 +34,7 @@
|
||||
{% endfor %}
|
||||
|
||||
{% set custom = utm.children.custom_parameters %}
|
||||
<h5 class="fw-sb mt-md mb-sm">{{ 'mautic.smartlinks.config.group.custom'|trans }}</h5>
|
||||
<h5 class="fw-sb mt-md mb-sm">{{ 'mt3s.smart_links.config.group.custom'|trans }}</h5>
|
||||
{{ form_errors(custom) }}
|
||||
<div class="panel-group mb-sm utm-custom-parameters"
|
||||
data-prototype="{{ form_widget(custom.vars.prototype)|e('html_attr') }}"
|
||||
@@ -43,9 +43,9 @@
|
||||
{{ form_widget(parameter) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p class="text-muted small utm-custom-empty{{ custom|length > 0 ? ' hide' : '' }}">{{ 'mautic.smartlinks.config.custom.empty'|trans }}</p>
|
||||
<p class="text-muted small utm-custom-empty{{ custom|length > 0 ? ' hide' : '' }}">{{ 'mt3s.smart_links.config.custom.empty'|trans }}</p>
|
||||
<button type="button" class="btn btn-default" data-utm-add-parameter>
|
||||
<i class="ri-add-line"></i> {{ 'mautic.smartlinks.config.custom.add'|trans }}
|
||||
<i class="ri-add-line"></i> {{ 'mt3s.smart_links.config.custom.add'|trans }}
|
||||
</button>
|
||||
{% do custom.setRendered() %}
|
||||
</div>
|
||||
@@ -61,10 +61,10 @@
|
||||
<div class="panel panel-default mb-xs utm-parameter" data-utm-parameter>
|
||||
<div class="panel-heading">
|
||||
<a class="panel-title d-flex" role="button" data-toggle="collapse" href="#{{ bodyId }}" aria-controls="{{ bodyId }}">
|
||||
<code class="utm-parameter-key mr-sm">{{ keyText is not empty ? keyText : 'mautic.smartlinks.config.custom.new'|trans }}</code>
|
||||
<code class="utm-parameter-key mr-sm">{{ keyText is not empty ? keyText : 'mt3s.smart_links.config.custom.new'|trans }}</code>
|
||||
<span class="text-muted">{{ fields.label.vars.value }}</span>
|
||||
{% if form.vars.utm_auto_generated %}
|
||||
<span class="label label-default ml-sm" data-toggle="tooltip" title="{{ 'mautic.smartlinks.config.auto_generated.tooltip'|trans }}">{{ 'mautic.smartlinks.config.auto_generated.badge'|trans }}</span>
|
||||
<span class="label label-default ml-sm" data-toggle="tooltip" title="{{ 'mt3s.smart_links.config.auto_generated.tooltip'|trans }}">{{ 'mt3s.smart_links.config.auto_generated.badge'|trans }}</span>
|
||||
{% endif %}
|
||||
{% if hasErrors %}<i class="ri-alert-line text-danger ml-sm"></i>{% endif %}
|
||||
</a>
|
||||
@@ -89,40 +89,40 @@
|
||||
{# Hidden unless mode = dropdown, by Mautic's form field state switcher (data-show-on). #}
|
||||
<div class="col-xs-12 utm-values-editor" id="{{ form.vars.id }}_values_editor"
|
||||
data-show-on="{{ {(fields.mode.vars.id): 'dropdown'}|json_encode|e('html_attr') }}">
|
||||
<label class="control-label">{{ 'mautic.smartlinks.config.values'|trans }}</label>
|
||||
<label class="control-label">{{ 'mt3s.smart_links.config.values'|trans }}</label>
|
||||
{{ form_errors(values) }}
|
||||
<div class="row small text-muted mb-xs">
|
||||
<div class="col-xs-1"></div>
|
||||
<div class="col-xs-4">{{ 'mautic.smartlinks.config.values.value'|trans }}</div>
|
||||
<div class="col-xs-4">{{ 'mautic.smartlinks.config.values.label'|trans }}</div>
|
||||
<div class="col-xs-2">{{ 'mautic.smartlinks.config.values.default'|trans }}</div>
|
||||
<div class="col-xs-4">{{ 'mt3s.smart_links.config.values.value'|trans }}</div>
|
||||
<div class="col-xs-4">{{ 'mt3s.smart_links.config.values.label'|trans }}</div>
|
||||
<div class="col-xs-2">{{ 'mt3s.smart_links.config.values.default'|trans }}</div>
|
||||
</div>
|
||||
<div class="utm-values-list" data-prototype="{{ form_widget(values.vars.prototype)|e('html_attr') }}">
|
||||
{% for row in values %}
|
||||
{{ form_widget(row) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p class="text-muted small utm-values-empty{{ values|length > 0 ? ' hide' : '' }}">{{ 'mautic.smartlinks.config.values.empty'|trans }}</p>
|
||||
<p class="text-muted small utm-values-empty{{ values|length > 0 ? ' hide' : '' }}">{{ 'mt3s.smart_links.config.values.empty'|trans }}</p>
|
||||
|
||||
<div class="mb-sm">
|
||||
<button type="button" class="btn btn-default btn-sm" data-utm-add-value>
|
||||
<i class="ri-add-line"></i> {{ 'mautic.smartlinks.config.values.add'|trans }}
|
||||
<i class="ri-add-line"></i> {{ 'mt3s.smart_links.config.values.add'|trans }}
|
||||
</button>
|
||||
{% if form.vars.utm_suggestions is not empty %}
|
||||
<button type="button" class="btn btn-default btn-sm{{ values|length > 0 ? ' hide' : '' }}" data-utm-load-suggestions
|
||||
data-utm-suggestions="{{ form.vars.utm_suggestions|json_encode|e('html_attr') }}">
|
||||
<i class="ri-magic-line"></i> {{ 'mautic.smartlinks.config.values.suggestions'|trans }}
|
||||
<i class="ri-magic-line"></i> {{ 'mt3s.smart_links.config.values.suggestions'|trans }}
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<label class="control-label small" for="{{ form.vars.id }}_import">{{ 'mautic.smartlinks.config.values.import'|trans }}</label>
|
||||
<label class="control-label small" for="{{ form.vars.id }}_import">{{ 'mt3s.smart_links.config.values.import'|trans }}</label>
|
||||
<div class="input-group mb-sm">
|
||||
{# Not a form field: the text is never submitted, the script turns it into value rows. #}
|
||||
<textarea id="{{ form.vars.id }}_import" class="form-control utm-import-text" rows="3"
|
||||
placeholder="{{ 'mautic.smartlinks.config.values.import.placeholder'|trans }}"></textarea>
|
||||
placeholder="{{ 'mt3s.smart_links.config.values.import.placeholder'|trans }}"></textarea>
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-default" data-utm-import>{{ 'mautic.smartlinks.config.values.import.button'|trans }}</button>
|
||||
<button type="button" class="btn btn-default" data-utm-import>{{ 'mt3s.smart_links.config.values.import.button'|trans }}</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
{% if isCustom %}
|
||||
<button type="button" class="btn btn-danger btn-sm" data-utm-remove-parameter>
|
||||
<i class="ri-delete-bin-line"></i> {{ 'mautic.smartlinks.config.custom.remove'|trans }}
|
||||
<i class="ri-delete-bin-line"></i> {{ 'mt3s.smart_links.config.custom.remove'|trans }}
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -145,7 +145,7 @@
|
||||
{% set fields = form.children %}
|
||||
<div class="row mb-xs utm-value-row">
|
||||
<div class="col-xs-1">
|
||||
<span class="btn btn-default btn-sm utm-value-handle" title="{{ 'mautic.smartlinks.config.values.drag'|trans }}"><i class="ri-draggable"></i></span>
|
||||
<span class="btn btn-default btn-sm utm-value-handle" title="{{ 'mt3s.smart_links.config.values.drag'|trans }}"><i class="ri-draggable"></i></span>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
{{ form_widget(fields.value) }}
|
||||
@@ -156,12 +156,12 @@
|
||||
{{ form_errors(fields.label) }}
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<label class="checkbox-inline" title="{{ 'mautic.smartlinks.config.values.default'|trans }}">
|
||||
<label class="checkbox-inline" title="{{ 'mt3s.smart_links.config.values.default'|trans }}">
|
||||
{{ form_widget(fields.is_default) }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-xs-1">
|
||||
<button type="button" class="btn btn-default btn-sm" data-utm-remove-value title="{{ 'mautic.smartlinks.config.values.remove'|trans }}">
|
||||
<button type="button" class="btn btn-default btn-sm" data-utm-remove-value title="{{ 'mt3s.smart_links.config.values.remove'|trans }}">
|
||||
<i class="ri-delete-bin-line"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{% extends '@MauticCore/Default/content.html.twig' %}
|
||||
|
||||
{% block mauticContent %}smartlinksSmartLink{% endblock %}
|
||||
{% block mauticContent %}mt3sMpSmartLink{% endblock %}
|
||||
|
||||
{% block headerTitle %}
|
||||
{% if form.vars.data.id %}
|
||||
{{ 'mautic.smartlinks.smart_links.header.edit'|trans({'%slug%': form.vars.data.slug}) }}
|
||||
{{ 'mt3s.smart_links.smart_links.header.edit'|trans({'%slug%': form.vars.data.slug}) }}
|
||||
{% else %}
|
||||
{{ 'mautic.smartlinks.smart_links.header.new'|trans }}
|
||||
{{ 'mt3s.smart_links.smart_links.header.new'|trans }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
data-domain="{{ form.vars.smart_link_domain }}"
|
||||
data-separator="{{ form.vars.smart_link_separator }}"
|
||||
data-lowercase="{{ form.vars.smart_link_lowercase ? '1' : '0' }}">
|
||||
<span class="text-muted">{{ 'mautic.smartlinks.smart_links.domain.reminder'|trans }}</span>
|
||||
<span class="text-muted">{{ 'mt3s.smart_links.smart_links.domain.reminder'|trans }}</span>
|
||||
<code id="smartLinkPreview">{{ form.vars.smart_link_domain ? form.vars.smart_link_domain ~ '/l/' : '' }}{{ form.vars.smart_link_slug }}</code>
|
||||
</div>
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-default" id="smartLinkGenerateSlug"
|
||||
data-generated="{{ form.vars.smart_link_generated }}"
|
||||
title="{{ 'mautic.smartlinks.smart_links.slug.generate.tooltip'|trans }}">
|
||||
title="{{ 'mt3s.smart_links.smart_links.slug.generate.tooltip'|trans }}">
|
||||
<i class="ri-refresh-line"></i>
|
||||
{{ 'mautic.smartlinks.smart_links.slug.generate'|trans }}
|
||||
{{ 'mt3s.smart_links.smart_links.slug.generate'|trans }}
|
||||
</button>
|
||||
</span>
|
||||
{% endif %}
|
||||
@@ -52,8 +52,8 @@
|
||||
</div>
|
||||
<div class="col-md-3 height-auto">
|
||||
<div class="pr-lg pl-lg pt-md pb-md">
|
||||
<h4>{{ 'mautic.smartlinks.smart_links.utm_parameters'|trans }}</h4>
|
||||
<p class="text-muted small">{{ 'mautic.smartlinks.smart_links.utm_parameters.help'|trans }}</p>
|
||||
<h4>{{ 'mt3s.smart_links.smart_links.utm_parameters'|trans }}</h4>
|
||||
<p class="text-muted small">{{ 'mt3s.smart_links.smart_links.utm_parameters.help'|trans }}</p>
|
||||
{# One fieldset per taxonomy: Mautic's data-show-on switcher shows the one of the
|
||||
chosen taxonomy (the container carries the col- class the switcher toggles). #}
|
||||
{% for taxonomyId, fieldset in form.vars.smart_link_utm_fieldsets %}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
{% set tmpl = 'list' %}
|
||||
{% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %}
|
||||
|
||||
{% block mauticContent %}smartlinksSmartLink{% endblock %}
|
||||
{% block mauticContent %}mt3sMpSmartLink{% endblock %}
|
||||
|
||||
{% block headerTitle %}{{ 'mautic.smartlinks.smart_links.header.index'|trans }}{% endblock %}
|
||||
{% block headerTitle %}{{ 'mt3s.smart_links.smart_links.header.index'|trans }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="page-list-wrapper" class="{% if items|length > 0 or searchValue is not empty %}panel {% endif %}panel-default">
|
||||
@@ -18,11 +18,11 @@
|
||||
'templateButtons': {
|
||||
'new': permissions[permissionBase ~ ':create'],
|
||||
},
|
||||
'langVar': 'smartlinks.smart_links',
|
||||
'langVar': 'mt3smarketingprogram.smart_links',
|
||||
'routeBase': 'smart_links',
|
||||
},
|
||||
'bulk_actions': {
|
||||
'langVar': 'smartlinks.smart_links',
|
||||
'langVar': 'mt3smarketingprogram.smart_links',
|
||||
'templateButtons': {
|
||||
'delete': permissions[permissionBase ~ ':deleteown'] or permissions[permissionBase ~ ':deleteother'],
|
||||
},
|
||||
@@ -43,31 +43,31 @@
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
'sessionVar': sessionVar,
|
||||
'orderBy': tablePrefix ~ '.slug',
|
||||
'text': 'mautic.smartlinks.smart_links.short_link',
|
||||
'text': 'mt3s.smart_links.smart_links.short_link',
|
||||
'class': 'col-smart-link-slug',
|
||||
'default': true,
|
||||
}) }}
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
'sessionVar': sessionVar,
|
||||
'text': 'mautic.smartlinks.smart_links.taxonomy',
|
||||
'text': 'mt3s.smart_links.smart_links.taxonomy',
|
||||
'class': 'visible-md visible-lg col-smart-link-taxonomy',
|
||||
}) }}
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
'sessionVar': sessionVar,
|
||||
'orderBy': tablePrefix ~ '.redirectType',
|
||||
'text': 'mautic.smartlinks.smart_links.redirect_type',
|
||||
'text': 'mt3s.smart_links.smart_links.redirect_type',
|
||||
'class': 'visible-md visible-lg col-smart-link-type',
|
||||
}) }}
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
'sessionVar': sessionVar,
|
||||
'orderBy': tablePrefix ~ '.destinationUrl',
|
||||
'text': 'mautic.smartlinks.smart_links.destination_url',
|
||||
'text': 'mt3s.smart_links.smart_links.destination_url',
|
||||
'class': 'visible-md visible-lg col-smart-link-destination',
|
||||
}) }}
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
'sessionVar': sessionVar,
|
||||
'orderBy': tablePrefix ~ '.hitCount',
|
||||
'text': 'mautic.smartlinks.smart_links.hits',
|
||||
'text': 'mt3s.smart_links.smart_links.hits',
|
||||
'class': 'col-smart-link-hits',
|
||||
}) }}
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
@@ -89,7 +89,7 @@
|
||||
'edit': canEdit,
|
||||
'delete': securityHasEntityAccess(permissions[permissionBase ~ ':deleteown'], permissions[permissionBase ~ ':deleteother'], item.createdBy),
|
||||
},
|
||||
'langVar': 'smartlinks.smart_links',
|
||||
'langVar': 'mt3smarketingprogram.smart_links',
|
||||
'routeBase': 'smart_links',
|
||||
}) -}}
|
||||
</td>
|
||||
@@ -107,14 +107,14 @@
|
||||
</td>
|
||||
<td class="visible-md visible-lg">
|
||||
<span class="label label-{{ item.redirectType.value == 'mautic' ? 'info' : 'warning' }}">
|
||||
{{ ('mautic.smartlinks.smart_links.redirect_type.' ~ item.redirectType.value)|trans ~ ' · ' ~ item.redirectCode.value }}
|
||||
{{ ('mt3s.smart_links.smart_links.redirect_type.' ~ item.redirectType.value)|trans ~ ' · ' ~ item.redirectCode.value }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="visible-md visible-lg text-muted">
|
||||
{{ item.destinationLabel|default('—') }}
|
||||
</td>
|
||||
<td>
|
||||
<span class="label label-info" title="{{ 'mautic.smartlinks.smart_links.hits.tooltip'|trans }}">
|
||||
<span class="label label-info" title="{{ 'mt3s.smart_links.smart_links.hits.tooltip'|trans }}">
|
||||
{{ hitCounts[item.id]|default(0) }}
|
||||
</span>
|
||||
</td>
|
||||
@@ -138,9 +138,9 @@
|
||||
{% else %}
|
||||
<div class="mt-80 col-md-offset-2 col-lg-offset-3 col-md-8 col-lg-5 height-auto">
|
||||
{{ include('@MauticCore/Components/content-block.html.twig', {
|
||||
'heading': 'mautic.smartlinks.smart_links.onboarding.heading',
|
||||
'subheading': 'mautic.smartlinks.smart_links.onboarding.subheading',
|
||||
'copy': 'mautic.smartlinks.smart_links.onboarding.copy',
|
||||
'heading': 'mt3s.smart_links.smart_links.onboarding.heading',
|
||||
'subheading': 'mt3s.smart_links.smart_links.onboarding.subheading',
|
||||
'copy': 'mt3s.smart_links.smart_links.onboarding.copy',
|
||||
}) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{% extends '@MauticCore/Default/content.html.twig' %}
|
||||
|
||||
{% block mauticContent %}smartlinksUtmTaxonomy{% endblock %}
|
||||
{% block mauticContent %}mt3sMpUtmTaxonomy{% endblock %}
|
||||
|
||||
{% block headerTitle %}
|
||||
{% if form.vars.data.id %}
|
||||
{{ 'mautic.smartlinks.taxonomies.header.edit'|trans({'%name%': form.vars.data.name}) }}
|
||||
{{ 'mt3s.smart_links.taxonomies.header.edit'|trans({'%name%': form.vars.data.name}) }}
|
||||
{% else %}
|
||||
{{ 'mautic.smartlinks.taxonomies.header.new'|trans }}
|
||||
{{ 'mt3s.smart_links.taxonomies.header.new'|trans }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
{{ form_row(form.name) }}
|
||||
{{ form_row(form.description) }}
|
||||
|
||||
<h4 class="fw-sb mt-lg mb-xs">{{ 'mautic.smartlinks.taxonomies.parameters'|trans }}</h4>
|
||||
<p class="text-muted small">{{ 'mautic.smartlinks.taxonomies.parameters.help'|trans }}</p>
|
||||
<h4 class="fw-sb mt-lg mb-xs">{{ 'mt3s.smart_links.taxonomies.parameters'|trans }}</h4>
|
||||
<p class="text-muted small">{{ 'mt3s.smart_links.taxonomies.parameters.help'|trans }}</p>
|
||||
{{ form_errors(form.parameters) }}
|
||||
<div class="panel panel-default mb-md">
|
||||
<div class="panel-body">
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
{% set tmpl = 'list' %}
|
||||
{% extends isIndex ? '@MauticCore/Default/content.html.twig' : '@MauticCore/Default/raw_output.html.twig' %}
|
||||
|
||||
{% block mauticContent %}smartlinksUtmTaxonomy{% endblock %}
|
||||
{% block mauticContent %}mt3sMpUtmTaxonomy{% endblock %}
|
||||
|
||||
{% block headerTitle %}{{ 'mautic.smartlinks.taxonomies.header.index'|trans }}{% endblock %}
|
||||
{% block headerTitle %}{{ 'mt3s.smart_links.taxonomies.header.index'|trans }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="page-list-wrapper" class="{% if items|length > 0 or searchValue is not empty %}panel {% endif %}panel-default">
|
||||
@@ -43,19 +43,19 @@
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
'sessionVar': sessionVar,
|
||||
'orderBy': tablePrefix ~ '.name',
|
||||
'text': 'mautic.smartlinks.taxonomies.name',
|
||||
'text': 'mt3s.smart_links.taxonomies.name',
|
||||
'class': 'col-utm-taxonomy-name',
|
||||
'default': true,
|
||||
}) }}
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
'sessionVar': sessionVar,
|
||||
'orderBy': tablePrefix ~ '.description',
|
||||
'text': 'mautic.smartlinks.taxonomies.description',
|
||||
'text': 'mt3s.smart_links.taxonomies.description',
|
||||
'class': 'visible-md visible-lg col-utm-taxonomy-description',
|
||||
}) }}
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
'sessionVar': sessionVar,
|
||||
'text': 'mautic.smartlinks.taxonomies.parameter_count',
|
||||
'text': 'mt3s.smart_links.taxonomies.parameter_count',
|
||||
'class': 'visible-md visible-lg col-utm-taxonomy-parameters',
|
||||
}) }}
|
||||
{{ include('@MauticCore/Helper/tableheader.html.twig', {
|
||||
@@ -92,7 +92,7 @@
|
||||
{{ item.description|default('—')|slice(0, 120) }}
|
||||
</td>
|
||||
<td class="visible-md visible-lg">
|
||||
<span class="label label-info" title="{{ 'mautic.smartlinks.taxonomies.parameter_count.tooltip'|trans }}">
|
||||
<span class="label label-info" title="{{ 'mt3s.smart_links.taxonomies.parameter_count.tooltip'|trans }}">
|
||||
{{ item.parameters|length }}
|
||||
</span>
|
||||
</td>
|
||||
@@ -116,9 +116,9 @@
|
||||
{% else %}
|
||||
<div class="mt-80 col-md-offset-2 col-lg-offset-3 col-md-8 col-lg-5 height-auto">
|
||||
{{ include('@MauticCore/Components/content-block.html.twig', {
|
||||
'heading': 'mautic.smartlinks.taxonomies.onboarding.heading',
|
||||
'subheading': 'mautic.smartlinks.taxonomies.onboarding.subheading',
|
||||
'copy': 'mautic.smartlinks.taxonomies.onboarding.copy',
|
||||
'heading': 'mt3s.smart_links.taxonomies.onboarding.heading',
|
||||
'subheading': 'mt3s.smart_links.taxonomies.onboarding.subheading',
|
||||
'copy': 'mt3s.smart_links.taxonomies.onboarding.copy',
|
||||
}) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -24,14 +24,14 @@ class MT3SMarketingProgramPermissions extends AbstractPermissions
|
||||
{
|
||||
parent::__construct($params);
|
||||
|
||||
$this->addStandardPermissions('categories');
|
||||
$this->addExtendedPermissions('programs');
|
||||
$this->addExtendedPermissions('tasks');
|
||||
$this->addExtendedPermissions('stakeholders');
|
||||
$this->addExtendedPermissions('audiences');
|
||||
$this->addExtendedPermissions('smart_links');
|
||||
$this->addExtendedPermissions('taxonomies');
|
||||
$this->addStandardPermissions('itemtypes');
|
||||
$this->addStandardPermissions(['categories']);
|
||||
$this->addExtendedPermissions(['programs']);
|
||||
$this->addExtendedPermissions(['tasks']);
|
||||
$this->addExtendedPermissions(['stakeholders']);
|
||||
$this->addExtendedPermissions(['audiences']);
|
||||
$this->addExtendedPermissions(['smart_links']);
|
||||
$this->addExtendedPermissions(['taxonomies']);
|
||||
$this->addStandardPermissions(['itemtypes']);
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
|
||||
@@ -104,4 +104,4 @@ class AudienceAttributes
|
||||
{
|
||||
return 'mt3s_marketing_program_audience_attribute_'.$attribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class ItemTypeInUseGuard
|
||||
ItemTypeProvider::KIND_ALLOCATION => $this->allocationItemRepository->countByType(),
|
||||
ItemTypeProvider::KIND_OBJECTIVE => $this->objectiveRepository->countByType(),
|
||||
ItemTypeProvider::KIND_TASK => $this->taskRepository->countByType(),
|
||||
ItemTypeProvider::KIND_STAKEHOLDER => $this->stakeholderRepository->countByType(),
|
||||
ItemTypeProvider::KIND_STAKEHOLDER => $this->stakeholderRepository->countByType(),
|
||||
];
|
||||
|
||||
$removedInUse = [];
|
||||
@@ -76,4 +76,4 @@ class ItemTypeInUseGuard
|
||||
|
||||
return $removedInUse;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*/
|
||||
class ItemTypeProvider
|
||||
{
|
||||
public const KIND_DESCRIPTION = 'description';
|
||||
public const KIND_ALLOCATION = 'allocation';
|
||||
public const KIND_OBJECTIVE = 'objective';
|
||||
public const KIND_TASK = 'task';
|
||||
public const KIND_STAKEHOLDER = 'stakeholder';
|
||||
public const KIND_DESCRIPTION = 'description';
|
||||
public const KIND_ALLOCATION = 'allocation';
|
||||
public const KIND_OBJECTIVE = 'objective';
|
||||
public const KIND_TASK = 'task';
|
||||
public const KIND_STAKEHOLDER = 'stakeholder';
|
||||
public const KIND_AUDIENCE_DECISION_ROLE = 'audience_decision_role';
|
||||
public const KIND_AUDIENCE_TONE = 'audience_tone';
|
||||
|
||||
@@ -46,11 +46,11 @@ class ItemTypeProvider
|
||||
* Kind => local.php parameter.
|
||||
*/
|
||||
public const PARAMETERS = [
|
||||
self::KIND_DESCRIPTION => 'mt3s_marketing_program_description_item_types',
|
||||
self::KIND_ALLOCATION => 'mt3s_marketing_program_allocation_item_types',
|
||||
self::KIND_OBJECTIVE => 'mt3s_marketing_program_objective_types',
|
||||
self::KIND_TASK => 'mt3s_marketing_program_task_types',
|
||||
self::KIND_STAKEHOLDER => 'mt3s_marketing_program_stakeholder_types',
|
||||
self::KIND_DESCRIPTION => 'mt3s_marketing_program_description_item_types',
|
||||
self::KIND_ALLOCATION => 'mt3s_marketing_program_allocation_item_types',
|
||||
self::KIND_OBJECTIVE => 'mt3s_marketing_program_objective_types',
|
||||
self::KIND_TASK => 'mt3s_marketing_program_task_types',
|
||||
self::KIND_STAKEHOLDER => 'mt3s_marketing_program_stakeholder_types',
|
||||
self::KIND_AUDIENCE_DECISION_ROLE => 'mt3s_marketing_program_audience_decision_roles',
|
||||
self::KIND_AUDIENCE_TONE => 'mt3s_marketing_program_audience_tones',
|
||||
];
|
||||
|
||||
@@ -30,12 +30,19 @@ final class SmartLinkShortUrlBuilder
|
||||
{
|
||||
$stored = $this->coreParametersHelper->get(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(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 = [
|
||||
SmartLinksConfigType::LEGACY_SMARTLINKS_PARAMETER,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use MauticPlugin\MT3SMarketingProgramBundle\Catalog\UtmParameterDefinition;
|
||||
use MauticPlugin\MT3SMarketingProgramBundle\Catalog\UtmParameterMode;
|
||||
|
||||
/**
|
||||
* Turns the stored `smartlinks_utm_config` array into a canonical, typed structure.
|
||||
* Turns the stored `mt3s_smart_links_utm_config` array into a canonical, typed structure.
|
||||
*
|
||||
* - Every catalog parameter is present (catalog defaults fill the gaps), followed by valid custom parameters.
|
||||
* - Mautic writes nested config scalars as strings ('1' / ''), so booleans are cast back.
|
||||
@@ -65,7 +65,7 @@ final class UtmConfigurationNormalizer
|
||||
*/
|
||||
private function normalizeParameter(mixed $stored, ?UtmParameterDefinition $definition): array
|
||||
{
|
||||
$defaultMode = $definition?->defaultMode ?? UtmParameterMode::DISABLED;
|
||||
$defaultMode = $definition->defaultMode ?? UtmParameterMode::DISABLED;
|
||||
$allowedModes = $definition?->getAllowedModes() ?? UtmParameterMode::ALL;
|
||||
|
||||
if (!is_array($stored)) {
|
||||
@@ -89,7 +89,7 @@ final class UtmConfigurationNormalizer
|
||||
return $parameter;
|
||||
}
|
||||
|
||||
$values = $this->normalizeValues($stored['values'] ?? []);
|
||||
$values = $this->normalizeValues($stored['values'] ?? []);
|
||||
$default = (string) ($stored['default'] ?? '');
|
||||
|
||||
$parameter['values'] = $values;
|
||||
|
||||
@@ -10,8 +10,8 @@ use MauticPlugin\MT3SMarketingProgramBundle\Catalog\UtmParameterMode;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* Read-only access to the UTM Manager configuration. Other services (e.g. the link builder)
|
||||
* must use this class instead of reading `smartlinks_utm_config` from local.php.
|
||||
* Read-only access to the Smart Links UTM configuration. Other services (e.g. the link builder)
|
||||
* must use this class instead of reading `mt3s_smart_links_utm_config` from local.php.
|
||||
*
|
||||
* Every returned parameter has this shape:
|
||||
* key, label, mode, enabled, group (standard|platform|custom), custom, auto_generated
|
||||
@@ -19,7 +19,10 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
*/
|
||||
final class UtmConfigurationProvider
|
||||
{
|
||||
public const CONFIG_PARAMETER = 'smartlinks_utm_config';
|
||||
public const CONFIG_PARAMETER = 'mt3s_smart_links_utm_config';
|
||||
|
||||
/** Key of the standalone SmartlinksBundle era (0.1.0–0.18.0); still honored until the settings are saved again. */
|
||||
public const LEGACY_SMARTLINKS_PARAMETER = 'smartlinks_utm_config';
|
||||
|
||||
/** Key of the UtmManagerBundle era (< 0.5.0); still honored until the settings are saved again. */
|
||||
public const LEGACY_CONFIG_PARAMETER = 'utm_manager_config';
|
||||
@@ -94,12 +97,16 @@ final class UtmConfigurationProvider
|
||||
{
|
||||
$raw = $this->coreParametersHelper->get(self::CONFIG_PARAMETER, []);
|
||||
|
||||
// Upgrades from < 0.5.0 keep their settings in local.php under the legacy key; serve them
|
||||
// until the Configuration page is saved again (which writes the new key).
|
||||
if (null === $raw || [] === $raw) {
|
||||
$legacy = $this->coreParametersHelper->get(self::LEGACY_CONFIG_PARAMETER, []);
|
||||
if (null !== $legacy && [] !== $legacy) {
|
||||
$raw = $legacy;
|
||||
// Upgrades keep their settings in local.php under a legacy key (the standalone
|
||||
// SmartlinksBundle wrote `smartlinks_utm_config`, the UtmManagerBundle before it
|
||||
// `utm_manager_config`); serve them until the Configuration page is saved again
|
||||
// (which writes the new key).
|
||||
foreach ([self::LEGACY_SMARTLINKS_PARAMETER, self::LEGACY_CONFIG_PARAMETER] as $legacyKey) {
|
||||
if (null === $raw || [] === $raw) {
|
||||
$legacy = $this->coreParametersHelper->get($legacyKey, []);
|
||||
if (null !== $legacy && [] !== $legacy) {
|
||||
$raw = $legacy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,9 +127,9 @@ final class UtmConfigurationProvider
|
||||
}
|
||||
|
||||
return ['key' => $key] + $parameter + [
|
||||
'group' => $definition?->group ?? UtmParameterCatalog::GROUP_CUSTOM,
|
||||
'group' => $definition->group ?? UtmParameterCatalog::GROUP_CUSTOM,
|
||||
'custom' => null === $definition,
|
||||
'auto_generated' => $definition?->autoGenerated ?? false,
|
||||
'auto_generated' => $definition->autoGenerated ?? false,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -51,8 +51,8 @@ final class UtmParameterCatalogTest extends TestCase
|
||||
$this->assertSame($mode, $definition->defaultMode, $key);
|
||||
$this->assertFalse($definition->autoGenerated, $key);
|
||||
$this->assertSame(UtmParameterMode::ALL, $definition->getAllowedModes(), $key);
|
||||
$this->assertSame('mautic.smartlinks.config.parameter.'.$key.'.label', $definition->getLabelKey());
|
||||
$this->assertSame('mautic.smartlinks.config.parameter.'.$key.'.description', $definition->getDescriptionKey());
|
||||
$this->assertSame('mt3s.smart_links.config.parameter.'.$key.'.label', $definition->getLabelKey());
|
||||
$this->assertSame('mt3s.smart_links.config.parameter.'.$key.'.description', $definition->getDescriptionKey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ final class UtmParameterCatalogTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertSame('mautic.smartlinks.config.suggestion.google_ads', UtmParameterDefinition::getSuggestionLabelKey('google_ads'));
|
||||
$this->assertSame('mt3s.smart_links.config.suggestion.google_ads', UtmParameterDefinition::getSuggestionLabelKey('google_ads'));
|
||||
}
|
||||
|
||||
public function testGetAndHas(): void
|
||||
|
||||
Loaded 100 of 119 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user