Files
mautic-marketing-program-bu…/Controller/UtmTaxonomyController.php
T
Alexandre Gain dce849610c Merge the Smartlinks plugin (SmartlinksBundle 0.6.0) into the bundle as the Smart Links domain (0.18.0)
Two domains, one MT3S bundle: Marketing Programs (unchanged) and the
imported Smart Links (smart links + UTM taxonomies), each keeping its
own menu, tables, routes and translations.

- Code moved from MauticPlugin\SmartlinksBundle\ to
  MauticPlugin\MT3SMarketingProgramBundle\; template namespace
  @Smartlinks/ -> @MT3SMarketingProgram/; smartlinks.js ->
  Assets/js/mt3s-mp-smartlinks.js; icon -> Assets/img/smartlinks-icon.svg.
- Incoming migrations renamed Version_0_X_0_SmartLinks.php to avoid
  the class-name collision; schema untouched, data intact.
- Permissions folded into MT3SMarketingProgramPermissions:
  smart_links + taxonomies under the mt3smarketingprogram: base
  (roles that had the old smartlinks: grants must be re-granted).
- config.php: Smart Links routes + menu group, public /l/{slug},
  SmartlinksIntegration services, smartlinks_* parameters (legacy
  utm_manager_* keys still readable), version 0.18.0. The 0.17.0
  placeholder /s/marketing-program-utm-taxonomies is replaced by the
  real /s/utm-taxonomies.
- Translations merged (en_US) and added (fr_FR); Tests/ + phpunit moved
  in; readme documents both domains and the 0.18.0 merge history.

Verified live: menus, both config tabs, both lists + forms, program
pages, public redirect with taxonomy UTM values, host + unknown-slug
404s, 90/90 unit tests, full php -l, all ini catalogs parse.
2026-11-16 13:48:13 +01:00

121 lines
3.2 KiB
PHP

<?php
declare(strict_types=1);
namespace MauticPlugin\MT3SMarketingProgramBundle\Controller;
use Mautic\CoreBundle\Controller\AbstractStandardFormController;
use Symfony\Component\HttpFoundation\Request;
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.
*
* 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';
protected function getModelName(): string
{
return 'smartlinks.utm_taxonomy';
}
protected function getTemplateBase(): string
{
return '@MT3SMarketingProgram/UtmTaxonomy';
}
protected function getIndexRoute(): string
{
return self::ROUTE_INDEX;
}
protected function getActionRoute(): string
{
return self::ROUTE_ACTION;
}
/**
* 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.
*/
protected function getJsLoadMethodPrefix(): string
{
return 'smartlinksUtmTaxonomy';
}
/**
* Core builds mautic.<model name>; every key of the feature lives under mautic.smartlinks.taxonomies.
*/
protected function getTranslationBase(): string
{
return 'mautic.smartlinks.taxonomies';
}
/**
* @param int $page
*/
public function indexAction(Request $request, $page = 1): Response
{
return $this->indexStandard($request, $page);
}
public function newAction(Request $request): Response
{
return $this->newStandard($request);
}
/**
* @param int $objectId
* @param bool $ignorePost
*/
public function editAction(Request $request, $objectId, $ignorePost = false): Response
{
return $this->editStandard($request, $objectId, $ignorePost);
}
/**
* @param int $objectId
*/
public function deleteAction(Request $request, $objectId): Response
{
return $this->deleteStandard($request, $objectId);
}
public function batchDeleteAction(Request $request): Response
{
return $this->batchDeleteStandard($request);
}
/**
* Taxonomies don't have a detail page; after Save or Cancel go back to the list.
*/
protected function getPostActionControllerAction($action): string
{
return 'index';
}
/**
* Order by name: the taxonomy has no other sortable business column.
*/
protected function getDefaultOrderColumn(): string
{
return 'name';
}
/**
* A saved taxonomy is never cloned: its name is unique, and a clone would collide on save.
*/
public function cloneAction(Request $request, $objectId): Response
{
$this->accessDenied();
}
}