Files
mautic-marketing-program-bu…/Controller/UtmTaxonomyController.php
T
Alexandre Gain b138056e43 style: fix indentation, alignment, and docblock annotations
- Correct getChoices() docblock to reflect translated label => enum
  backing value order instead of value => label
- Re-indent Smart Links menu config to match actual array nesting
- Align assignment operators in RefreshStatsCommand
- Add missing newline at end of RefreshStatsCommand.php
2026-11-21 11:23:33 +01:00

126 lines
3.3 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 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 = 'mt3s_smart_links_taxonomies';
public const ROUTE_ACTION = 'mt3s_smart_links_taxonomy_action';
protected function getModelName(): string
{
return 'mt3smarketingprogram.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;
}
/**
* 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 'mt3sMpUtmTaxonomy';
}
/**
* Core builds mautic.<model name>; every key of the feature lives under mt3s.smart_links.taxonomies.
*/
protected function getTranslationBase(): string
{
return 'mt3s.smart_links.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.
*
* @param string $action
*/
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.
*
* @param int|null $objectId
*/
public function cloneAction(Request $request, $objectId): Response
{
$this->throwAccessDenied();
}
}