refactor(plugin): rebrand as MT3SMarketingProgram, release 0.17.0

Rename the plugin's vendor/namespace from experiential/Program to mt3s/MT3SMarketingProgram (composer: mt3s/mautic-marketing-program-bundle):

- ProgramBundle -> MT3SMarketingProgramBundle; extension, integration,
  config support, permissions, events and twig extension renamed likewise
- Initiative* -> Program*: controller (InitiativeController ->
  ProgramController), model, entities, repositories, form types and views
  (new _tabs/_task_table/_tab_table_filter partials, details page)
- Settings config form theme -> _config_mt3smarketingprogramconfig_widget;
  routes and translations re-prefixed (mt3s_marketing_program_*)
- Assets: icon.svg -> mt3s-mp-icon.svg; program.js -> mt3s-mp-program.js
  (OnLoad hooks renamed mt3sMpProgram*)
- Add Command/RefreshStatsCommand; Migrations/Version_0_17_0.php renames
  the tables to mt3s_mp_program_*
This commit is contained in:
Alexandre Gain committed 2026-11-15 17:48:01 +01:00
1 parent 687d33d30c
commit ea88b7a772
131 files changed
+3238 -2836

No files matched your search

+23 -23
View File
@@ -2,17 +2,17 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use Mautic\CoreBundle\Form\Type\FormButtonsType;
use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType;
use Mautic\LeadBundle\Entity\LeadList;
use Mautic\StageBundle\Entity\Stage;
use MauticPlugin\ProgramBundle\Entity\Audience;
use MauticPlugin\ProgramBundle\Entity\AudienceType as AudienceTypeEnum;
use MauticPlugin\ProgramBundle\Service\AudienceAttributes;
use MauticPlugin\ProgramBundle\Service\ItemTypeProvider;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\AudienceType as AudienceTypeEnum;
use MauticPlugin\MT3SMarketingProgramBundle\Service\AudienceAttributes;
use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -26,7 +26,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* The create and edit form of an audience of the global directory (Programs > Audiences): name, a
* fixed type (persona, ICP, …), the segments (purely informational), then the persona attributes
* the admin switched on in Settings > Configuration > Initiative Settings (AudienceAttributes): one
* 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>
@@ -45,13 +45,13 @@ class AudienceType extends AbstractType
// Name and type are always offered; everything else is a togglable attribute.
$builder->add('name', TextType::class, [
'label' => 'mautic.program.audience.field.name',
'label' => 'mt3s.marketing_program.audience.field.name',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 191],
]);
$builder->add('audienceType', EnumType::class, [
'label' => 'mautic.program.audience.field.type',
'label' => 'mt3s.marketing_program.audience.field.type',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => AudienceTypeEnum::class,
@@ -59,9 +59,9 @@ class AudienceType extends AbstractType
]);
// The Mautic segments this audience maps to; any number, or none. Purely informational: the
// segments are not required, and nothing in the initiative depends on them.
// segments are not required, and nothing in the program depends on them.
$builder->add('segments', EntityType::class, [
'label' => 'mautic.program.audience.field.segments',
'label' => 'mt3s.marketing_program.audience.field.segments',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => LeadList::class,
@@ -77,7 +77,7 @@ class AudienceType extends AbstractType
if (in_array('tagline', $enabled, true)) {
$builder->add('tagline', TextareaType::class, [
'label' => 'mautic.program.audience.field.tagline',
'label' => 'mt3s.marketing_program.audience.field.tagline',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 2, 'maxlength' => 500],
'required' => false,
@@ -86,7 +86,7 @@ class AudienceType extends AbstractType
if (in_array('profile', $enabled, true)) {
$builder->add('profileCriteria', TextareaType::class, [
'label' => 'mautic.program.audience.field.profile_criteria',
'label' => 'mt3s.marketing_program.audience.field.profile_criteria',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 3],
'required' => false,
@@ -95,7 +95,7 @@ class AudienceType extends AbstractType
if (in_array('motivations', $enabled, true)) {
$builder->add('motivations', TextareaType::class, [
'label' => 'mautic.program.audience.field.motivations',
'label' => 'mt3s.marketing_program.audience.field.motivations',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 3],
'required' => false,
@@ -104,7 +104,7 @@ class AudienceType extends AbstractType
if (in_array('barriers', $enabled, true)) {
$builder->add('barriers', TextareaType::class, [
'label' => 'mautic.program.audience.field.barriers',
'label' => 'mt3s.marketing_program.audience.field.barriers',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 3],
'required' => false,
@@ -113,7 +113,7 @@ class AudienceType extends AbstractType
if (in_array('frustrations', $enabled, true)) {
$builder->add('frustrations', TextareaType::class, [
'label' => 'mautic.program.audience.field.frustrations',
'label' => 'mt3s.marketing_program.audience.field.frustrations',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 3],
'required' => false,
@@ -122,7 +122,7 @@ class AudienceType extends AbstractType
if (in_array('triggers', $enabled, true)) {
$builder->add('triggers', TextareaType::class, [
'label' => 'mautic.program.audience.field.triggers',
'label' => 'mt3s.marketing_program.audience.field.triggers',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 3],
'required' => false,
@@ -132,7 +132,7 @@ class AudienceType extends AbstractType
if (in_array('decision_role', $enabled, true)) {
$kind = ItemTypeProvider::KIND_AUDIENCE_DECISION_ROLE;
$builder->add('decisionRole', ChoiceType::class, [
'label' => 'mautic.program.audience.field.decision_role',
'label' => 'mt3s.marketing_program.audience.field.decision_role',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'choices' => $this->typeProvider->getChoices($kind),
@@ -144,7 +144,7 @@ class AudienceType extends AbstractType
if (in_array('tones', $enabled, true)) {
$kind = ItemTypeProvider::KIND_AUDIENCE_TONE;
$builder->add('preferredTones', ChoiceType::class, [
'label' => 'mautic.program.audience.field.preferred_tones',
'label' => 'mt3s.marketing_program.audience.field.preferred_tones',
'label_attr' => ['class' => 'control-label'],
'choices' => $this->typeProvider->getChoices($kind),
'expanded' => true,
@@ -156,7 +156,7 @@ class AudienceType extends AbstractType
if (in_array('channels', $enabled, true)) {
// One checkbox per channel, in the order of Audience::CHANNELS.
$builder->add('preferredChannels', ChoiceType::class, [
'label' => 'mautic.program.audience.field.preferred_channels',
'label' => 'mt3s.marketing_program.audience.field.preferred_channels',
'label_attr' => ['class' => 'control-label'],
'choices' => array_flip(Audience::CHANNELS),
'expanded' => true,
@@ -167,7 +167,7 @@ class AudienceType extends AbstractType
if (in_array('stages', $enabled, true)) {
$builder->add('stages', EntityType::class, [
'label' => 'mautic.program.audience.field.stages',
'label' => 'mt3s.marketing_program.audience.field.stages',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => Stage::class,
@@ -181,7 +181,7 @@ class AudienceType extends AbstractType
if (in_array('size', $enabled, true)) {
$builder->add('estimatedSize', IntegerType::class, [
'label' => 'mautic.program.audience.field.estimated_size',
'label' => 'mt3s.marketing_program.audience.field.estimated_size',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'min' => 0, 'step' => 1],
'required' => false,
@@ -189,7 +189,7 @@ class AudienceType extends AbstractType
}
$builder->add('isPublished', YesNoButtonGroupType::class, [
'label' => 'mautic.program.audience.field.active',
'label' => 'mt3s.marketing_program.audience.field.active',
]);
$builder->add('buttons', FormButtonsType::class);
@@ -208,6 +208,6 @@ class AudienceType extends AbstractType
public function getBlockPrefix(): string
{
return 'program_audience';
return 'mt3s_marketing_program_audience';
}
}
+12 -12
View File
@@ -2,11 +2,11 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use MauticPlugin\ProgramBundle\Model\StakeholderModel;
use MauticPlugin\ProgramBundle\Service\CurrencyProvider;
use MauticPlugin\ProgramBundle\Service\AudienceAttributes;
use MauticPlugin\MT3SMarketingProgramBundle\Model\StakeholderModel;
use MauticPlugin\MT3SMarketingProgramBundle\Service\CurrencyProvider;
use MauticPlugin\MT3SMarketingProgramBundle\Service\AudienceAttributes;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -17,8 +17,8 @@ use Symfony\Component\Validator\Constraints\NotBlank;
/**
* The "Program Settings" tab of Settings > Configuration: the plugin's general settings only.
* Each child is a local.php parameter:
* - program_currency: the currency of every amount in the plugin (general setting);
* - program_stakeholder_phone_region: default region for stakeholder phone numbers typed without a prefix;
* - mt3s_marketing_program_currency: the currency of every amount in the plugin (general setting);
* - mt3s_marketing_program_stakeholder_phone_region: default region for stakeholder phone numbers typed without a prefix;
* - one toggle per audience persona attribute (AudienceAttributes), so each install defines its
* personas as it needs (b2b, b2c…).
*
@@ -29,7 +29,7 @@ use Symfony\Component\Validator\Constraints\NotBlank;
*/
class ConfigType extends AbstractType
{
public const FORM_ALIAS = 'programconfig';
public const FORM_ALIAS = 'mt3smarketingprogramconfig';
public function __construct(
private CurrencyProvider $currencyProvider,
@@ -40,9 +40,9 @@ class ConfigType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add(CurrencyProvider::CONFIG_PARAMETER, ChoiceType::class, [
'label' => 'mautic.program.config.currency',
'label' => 'mt3s.marketing_program.config.currency',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.program.config.currency.tooltip'],
'attr' => ['class' => 'form-control', 'tooltip' => 'mt3s.marketing_program.config.currency.tooltip'],
'choices' => $this->currencyProvider->getChoices(),
'placeholder' => false,
'required' => true,
@@ -53,9 +53,9 @@ class ConfigType extends AbstractType
// Default region for stakeholder phone numbers typed without a country prefix (ISO 3166-1
// alpha-2, e.g. FR). Read by StakeholderModel on save.
$builder->add(StakeholderModel::PHONE_REGION_PARAMETER, TextType::class, [
'label' => 'mautic.program.config.stakeholder_phone_region',
'label' => 'mt3s.marketing_program.config.stakeholder_phone_region',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'tooltip' => 'mautic.program.config.stakeholder_phone_region.tooltip', 'maxlength' => 2],
'attr' => ['class' => 'form-control', 'tooltip' => 'mt3s.marketing_program.config.stakeholder_phone_region.tooltip', 'maxlength' => 2],
'required' => true,
'constraints' => [new NotBlank()],
'empty_data' => StakeholderModel::DEFAULT_PHONE_REGION,
@@ -64,7 +64,7 @@ class ConfigType extends AbstractType
// One toggle per audience persona attribute (AudienceAttributes), defaults to enabled.
foreach (AudienceAttributes::ATTRIBUTES as $attribute => $field) {
$builder->add(AudienceAttributes::toggleParameter($attribute), YesNoButtonGroupType::class, [
'label' => 'mautic.program.audience.attribute.'.$attribute,
'label' => 'mt3s.marketing_program.audience.attribute.'.$attribute,
'label_attr' => ['class' => 'control-label'],
'data' => $this->audienceAttributes->isEnabled($attribute),
'required' => false,
+12 -12
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use MauticPlugin\ProgramBundle\Service\ItemTypeProvider;
use MauticPlugin\ProgramBundle\Service\Pictograms;
use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider;
use MauticPlugin\MT3SMarketingProgramBundle\Service\Pictograms;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\FormType;
@@ -40,7 +40,7 @@ class ItemTypeConfigType extends AbstractType
$default = $this->typeProvider->getDefaultLocale();
$builder->add('key', HiddenType::class, [
'attr' => ['class' => 'initiative-type-key'],
'attr' => ['class' => 'program-type-key'],
]);
$names = $builder->create('names', FormType::class, ['label' => false]);
@@ -50,17 +50,17 @@ class ItemTypeConfigType extends AbstractType
$isDefault = $locale === $default;
$names->add($locale, TextType::class, [
'label' => 'mautic.program.config.type.name',
'label' => 'mt3s.marketing_program.config.type.name',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 191, 'data-locale' => $locale, 'data-language' => $language],
'required' => $isDefault,
'constraints' => $isDefault
? [new NotBlank(message: 'mautic.program.config.type.name.required'), new Length(max: 191)]
? [new NotBlank(message: 'mt3s.marketing_program.config.type.name.required'), new Length(max: 191)]
: [new Length(max: 191)],
]);
$descriptions->add($locale, TextareaType::class, [
'label' => 'mautic.program.config.type.description',
'label' => 'mt3s.marketing_program.config.type.description',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 2, 'data-locale' => $locale],
'required' => false,
@@ -70,15 +70,15 @@ class ItemTypeConfigType extends AbstractType
$builder->add($names);
$builder->add($descriptions);
// Pictogram; the preview next to the dropdown is updated by program.js.
// Pictogram; the preview next to the dropdown is updated by mt3s-mp-program.js.
if ($options['with_icon']) {
$builder->add('icon', ChoiceType::class, [
'label' => 'mautic.program.config.type.icon',
'label' => 'mt3s.marketing_program.config.type.icon',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control initiative-type-icon-select'],
'attr' => ['class' => 'form-control program-type-icon-select'],
'choices' => Pictograms::getChoices(),
'choice_attr' => fn (?string $icon): array => ['data-icon' => (string) $icon],
'placeholder' => 'mautic.program.config.type.icon.none',
'placeholder' => 'mt3s.marketing_program.config.type.icon.none',
'required' => false,
]);
}
@@ -104,6 +104,6 @@ class ItemTypeConfigType extends AbstractType
public function getBlockPrefix(): string
{
return 'program_item_type_config';
return 'mt3s_marketing_program_item_type_config';
}
}
+4 -4
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use Mautic\CoreBundle\Form\Type\FormButtonsType;
use MauticPlugin\ProgramBundle\Service\ItemTypeProvider;
use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
@@ -52,7 +52,7 @@ class ItemTypesType extends AbstractType
public function getBlockPrefix(): string
{
// The POST data keys: program_item_types[<parameter>][<index>][…].
return 'program_item_types';
// The POST data keys: mt3s_marketing_program_item_types[<parameter>][<index>][…].
return 'mt3s_marketing_program_item_types';
}
}
@@ -2,11 +2,11 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use MauticPlugin\ProgramBundle\Entity\InitiativeAllocationItem;
use MauticPlugin\ProgramBundle\Service\CurrencyProvider;
use MauticPlugin\ProgramBundle\Service\ItemTypeProvider;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramAllocationItem;
use MauticPlugin\MT3SMarketingProgramBundle\Service\CurrencyProvider;
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\HiddenType;
@@ -17,14 +17,14 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* One row of the allocation items collection in InitiativeType: type, name, description, planned cost and
* real cost (both in the general currency). Works like InitiativeDescriptionItemType (type description shown
* One row of the allocation items collection in ProgramType: type, name, description, planned cost and
* 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/program.js).
* Assets/js/mt3s-mp-program.js).
*
* @extends AbstractType<InitiativeAllocationItem>
* @extends AbstractType<ProgramAllocationItem>
*/
class InitiativeAllocationItemType extends AbstractType
class ProgramAllocationItemType extends AbstractType
{
public function __construct(
private ItemTypeProvider $typeProvider,
@@ -37,11 +37,11 @@ class InitiativeAllocationItemType extends AbstractType
$kind = ItemTypeProvider::KIND_ALLOCATION;
$builder->add('type', ChoiceType::class, [
'label' => 'mautic.program.allocation_item.field.type',
'label' => 'mt3s.marketing_program.allocation_item.field.type',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control initiative-item-type'],
'attr' => ['class' => 'form-control program-item-type'],
'choices' => $this->typeProvider->getChoices($kind),
// The type's description and pictogram, shown next to the dropdown by program.js.
// The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js.
'choice_attr' => fn (?string $key): array => [
'data-description' => (string) $this->typeProvider->getDescription($kind, $key),
'data-icon' => (string) $this->typeProvider->getIcon($kind, $key),
@@ -51,23 +51,23 @@ class InitiativeAllocationItemType extends AbstractType
]);
$builder->add('name', TextType::class, [
'label' => 'mautic.program.allocation_item.field.name',
'label' => 'mt3s.marketing_program.allocation_item.field.name',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 255],
'required' => false,
]);
$builder->add('description', TextareaType::class, [
'label' => 'mautic.program.allocation_item.field.description',
'label' => 'mt3s.marketing_program.allocation_item.field.description',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 3],
'required' => false,
]);
// Costs are in the general currency (Settings > Configuration > Initiative Settings), shown next to the field.
// Costs are in the general currency (Settings > Configuration > Program Settings), shown next to the field.
foreach (['planned', 'real'] as $cost) {
$builder->add($cost.'Cost', NumberType::class, [
'label' => 'mautic.program.allocation_item.field.'.$cost.'_cost',
'label' => 'mt3s.marketing_program.allocation_item.field.'.$cost.'_cost',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'postaddon_text' => $this->currencyProvider->getCurrency()],
'input' => 'string',
@@ -77,19 +77,19 @@ class InitiativeAllocationItemType extends AbstractType
}
$builder->add('position', HiddenType::class, [
'attr' => ['class' => 'initiative-row-position'],
'attr' => ['class' => 'program-row-position'],
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => InitiativeAllocationItem::class,
'data_class' => ProgramAllocationItem::class,
]);
}
public function getBlockPrefix(): string
{
return 'program_allocation_item';
return 'mt3s_marketing_program_allocation_item';
}
}
@@ -2,12 +2,12 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use MauticPlugin\ProgramBundle\Entity\Audience;
use MauticPlugin\ProgramBundle\Entity\AudiencePriority;
use MauticPlugin\ProgramBundle\Entity\InitiativeAudience;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Audience;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\AudiencePriority;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramAudience;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EnumType;
@@ -17,18 +17,18 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* One row of the audiences collection in InitiativeType: an audience of the global directory (only the
* active ones are offered), the audience's priority in this plan, and possibly a initiative-specific
* message. The position field is hidden and kept in display order by Assets/js/program.js.
* 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<InitiativeAudience>
* @extends AbstractType<ProgramAudience>
*/
class InitiativeAudienceType extends AbstractType
class ProgramAudienceType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('audience', EntityType::class, [
'label' => 'mautic.program.audience.field.name',
'label' => 'mt3s.marketing_program.audience.field.name',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => Audience::class,
@@ -43,7 +43,7 @@ class InitiativeAudienceType extends AbstractType
// Dropdown in the order of the AudiencePriority cases.
$builder->add('priority', EnumType::class, [
'label' => 'mautic.program.audience.field.priority',
'label' => 'mt3s.marketing_program.audience.field.priority',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => AudiencePriority::class,
@@ -51,26 +51,26 @@ class InitiativeAudienceType extends AbstractType
]);
$builder->add('valueProposition', TextareaType::class, [
'label' => 'mautic.program.audience.field.value_proposition',
'label' => 'mt3s.marketing_program.audience.field.value_proposition',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 2],
'required' => false,
]);
$builder->add('position', HiddenType::class, [
'attr' => ['class' => 'initiative-row-position'],
'attr' => ['class' => 'program-row-position'],
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => InitiativeAudience::class,
'data_class' => ProgramAudience::class,
]);
}
public function getBlockPrefix(): string
{
return 'program_initiative_audience';
return 'mt3s_marketing_program_program_audience';
}
}
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use MauticPlugin\ProgramBundle\Entity\InitiativeDescriptionItem;
use MauticPlugin\ProgramBundle\Service\ItemTypeProvider;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramDescriptionItem;
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\HiddenType;
@@ -14,14 +14,14 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* One row of the description items collection in InitiativeType. The type dropdown lists the description item
* types set up in Settings > Configuration > Initiative; each option carries the type's description, which
* Assets/js/program.js shows under the dropdown. The position field is hidden and kept in display order by
* program.js.
* One row of the description items collection in ProgramType. The type dropdown lists the description item
* 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<InitiativeDescriptionItem>
* @extends AbstractType<ProgramDescriptionItem>
*/
class InitiativeDescriptionItemType extends AbstractType
class ProgramDescriptionItemType extends AbstractType
{
public function __construct(
private ItemTypeProvider $typeProvider,
@@ -33,11 +33,11 @@ class InitiativeDescriptionItemType extends AbstractType
$kind = ItemTypeProvider::KIND_DESCRIPTION;
$builder->add('type', ChoiceType::class, [
'label' => 'mautic.program.description_item.field.type',
'label' => 'mt3s.marketing_program.description_item.field.type',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control initiative-item-type'],
'attr' => ['class' => 'form-control program-item-type'],
'choices' => $this->typeProvider->getChoices($kind),
// The type's description and pictogram, shown next to the dropdown by program.js.
// The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js.
'choice_attr' => fn (?string $key): array => [
'data-description' => (string) $this->typeProvider->getDescription($kind, $key),
'data-icon' => (string) $this->typeProvider->getIcon($kind, $key),
@@ -47,26 +47,26 @@ class InitiativeDescriptionItemType extends AbstractType
]);
$builder->add('description', TextareaType::class, [
'label' => 'mautic.program.description_item.field.description',
'label' => 'mt3s.marketing_program.description_item.field.description',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 5],
'required' => false,
]);
$builder->add('position', HiddenType::class, [
'attr' => ['class' => 'initiative-row-position'],
'attr' => ['class' => 'program-row-position'],
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => InitiativeDescriptionItem::class,
'data_class' => ProgramDescriptionItem::class,
]);
}
public function getBlockPrefix(): string
{
return 'program_description_item';
return 'mt3s_marketing_program_description_item';
}
}
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use MauticPlugin\ProgramBundle\Entity\InitiativeObjective;
use MauticPlugin\ProgramBundle\Service\ItemTypeProvider;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramObjective;
use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -17,13 +17,13 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* One row of the objectives collection in InitiativeType: type, title, priority, description and the achieved
* flag. Works like InitiativeDescriptionItemType (type description shown under the dropdown and its pictogram
* next to it, hidden position kept in display order by Assets/js/program.js).
* 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<InitiativeObjective>
* @extends AbstractType<ProgramObjective>
*/
class InitiativeObjectiveType extends AbstractType
class ProgramObjectiveType extends AbstractType
{
public function __construct(
private ItemTypeProvider $typeProvider,
@@ -35,11 +35,11 @@ class InitiativeObjectiveType extends AbstractType
$kind = ItemTypeProvider::KIND_OBJECTIVE;
$builder->add('type', ChoiceType::class, [
'label' => 'mautic.program.objective.field.type',
'label' => 'mt3s.marketing_program.objective.field.type',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control initiative-item-type'],
'attr' => ['class' => 'form-control program-item-type'],
'choices' => $this->typeProvider->getChoices($kind),
// The type's description and pictogram, shown next to the dropdown by program.js.
// The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js.
'choice_attr' => fn (?string $key): array => [
'data-description' => (string) $this->typeProvider->getDescription($kind, $key),
'data-icon' => (string) $this->typeProvider->getIcon($kind, $key),
@@ -49,36 +49,36 @@ class InitiativeObjectiveType extends AbstractType
]);
$builder->add('title', TextType::class, [
'label' => 'mautic.program.objective.field.title',
'label' => 'mt3s.marketing_program.objective.field.title',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 255],
]);
$builder->add('priority', IntegerType::class, [
'label' => 'mautic.program.objective.field.priority',
'label' => 'mt3s.marketing_program.objective.field.priority',
'label_attr' => ['class' => 'control-label'],
'invalid_message' => 'mautic.program.objective.priority.range',
'invalid_message' => 'mt3s.marketing_program.objective.priority.range',
'attr' => [
'class' => 'form-control',
'min' => InitiativeObjective::PRIORITY_MIN,
'max' => InitiativeObjective::PRIORITY_MAX,
'min' => ProgramObjective::PRIORITY_MIN,
'max' => ProgramObjective::PRIORITY_MAX,
'step' => 1,
],
]);
$builder->add('description', TextareaType::class, [
'label' => 'mautic.program.objective.field.description',
'label' => 'mt3s.marketing_program.objective.field.description',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 2],
'required' => false,
]);
$builder->add('position', HiddenType::class, [
'attr' => ['class' => 'initiative-row-position'],
'attr' => ['class' => 'program-row-position'],
]);
$builder->add('isAchieved', CheckboxType::class, [
'label' => 'mautic.program.objective.field.is_achieved',
'label' => 'mt3s.marketing_program.objective.field.is_achieved',
'required' => false,
]);
}
@@ -86,12 +86,12 @@ class InitiativeObjectiveType extends AbstractType
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => InitiativeObjective::class,
'data_class' => ProgramObjective::class,
]);
}
public function getBlockPrefix(): string
{
return 'program_objective';
return 'mt3s_marketing_program_objective';
}
}
@@ -2,11 +2,11 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use MauticPlugin\ProgramBundle\Entity\InitiativeStakeholder;
use MauticPlugin\ProgramBundle\Entity\Stakeholder;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\ProgramStakeholder;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
@@ -15,18 +15,18 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* One row of the stakeholders collection in InitiativeType: a stakeholder of the global directory (only the
* 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/program.js.
* kept in display order by Assets/js/mt3s-mp-program.js.
*
* @extends AbstractType<InitiativeStakeholder>
* @extends AbstractType<ProgramStakeholder>
*/
class InitiativeStakeholderType extends AbstractType
class ProgramStakeholderType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('stakeholder', EntityType::class, [
'label' => 'mautic.program.stakeholder.field.name',
'label' => 'mt3s.marketing_program.stakeholder.field.name',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => Stakeholder::class,
@@ -39,27 +39,27 @@ class InitiativeStakeholderType extends AbstractType
'required' => true,
]);
$builder->add('roleInInitiative', TextType::class, [
'label' => 'mautic.program.stakeholder.field.role_in_initiative',
$builder->add('roleInProgram', TextType::class, [
'label' => 'mt3s.marketing_program.stakeholder.field.role_in_program',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 191],
'required' => false,
]);
$builder->add('position', HiddenType::class, [
'attr' => ['class' => 'initiative-row-position'],
'attr' => ['class' => 'program-row-position'],
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => InitiativeStakeholder::class,
'data_class' => ProgramStakeholder::class,
]);
}
public function getBlockPrefix(): string
{
return 'program_initiative_stakeholder';
return 'mt3s_marketing_program_program_stakeholder';
}
}
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use Doctrine\ORM\EntityManagerInterface;
use Mautic\CategoryBundle\Form\Type\CategoryListType;
@@ -13,11 +13,11 @@ use Mautic\CoreBundle\Form\Type\FormButtonsType;
use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType;
use Mautic\UserBundle\Entity\User;
use Mautic\UserBundle\Form\Type\UserListType;
use MauticPlugin\ProgramBundle\Entity\Initiative;
use MauticPlugin\ProgramBundle\Entity\InitiativeStatus;
use MauticPlugin\ProgramBundle\Service\CurrencyProvider;
use MauticPlugin\ProgramBundle\Form\Type\InitiativeAudienceType;
use MauticPlugin\ProgramBundle\Form\Type\InitiativeStakeholderType;
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;
@@ -28,9 +28,9 @@ use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* @extends AbstractType<Initiative>
* @extends AbstractType<Program>
*/
class InitiativeType extends AbstractType
class ProgramType extends AbstractType
{
public function __construct(
private CurrencyProvider $currencyProvider,
@@ -47,15 +47,15 @@ class InitiativeType extends AbstractType
$builder->addEventSubscriber(new CleanFormSubscriber(['name' => 'filter']));
$builder->add('name', TextType::class, [
'label' => 'mautic.program.field.name',
'label' => 'mt3s.marketing_program.field.name',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
]);
// The Description tab. by_reference false: Symfony calls Initiative::addDescriptionItem()/removeDescriptionItem().
// The Description tab. by_reference false: Symfony calls Program::addDescriptionItem()/removeDescriptionItem().
$builder->add('descriptionItems', CollectionType::class, [
'label' => 'mautic.program.field.description_items',
'entry_type' => InitiativeDescriptionItemType::class,
'label' => 'mt3s.marketing_program.field.description_items',
'entry_type' => ProgramDescriptionItemType::class,
'entry_options' => ['label' => false],
'allow_add' => true,
'allow_delete' => true,
@@ -67,8 +67,8 @@ class InitiativeType extends AbstractType
// The Allocations tab's cost lines, in the general currency.
$builder->add('allocationItems', CollectionType::class, [
'label' => 'mautic.program.field.allocation_items',
'entry_type' => InitiativeAllocationItemType::class,
'label' => 'mt3s.marketing_program.field.allocation_items',
'entry_type' => ProgramAllocationItemType::class,
'entry_options' => ['label' => false],
'allow_add' => true,
'allow_delete' => true,
@@ -79,10 +79,10 @@ class InitiativeType extends AbstractType
]);
// The Audiences tab's links to the global directory. by_reference false: Symfony calls
// Initiative::addAudience()/removeAudience().
// Program::addAudience()/removeAudience().
$builder->add('audiences', CollectionType::class, [
'label' => 'mautic.program.field.audiences',
'entry_type' => InitiativeAudienceType::class,
'label' => 'mt3s.marketing_program.field.audiences',
'entry_type' => ProgramAudienceType::class,
'entry_options' => ['label' => false],
'allow_add' => true,
'allow_delete' => true,
@@ -93,10 +93,10 @@ class InitiativeType extends AbstractType
]);
// The Stakeholders tab's links to the global directory. by_reference false: Symfony calls
// Initiative::addStakeholder()/removeStakeholder().
// Program::addStakeholder()/removeStakeholder().
$builder->add('stakeholders', CollectionType::class, [
'label' => 'mautic.program.field.stakeholders',
'entry_type' => InitiativeStakeholderType::class,
'label' => 'mt3s.marketing_program.field.stakeholders',
'entry_type' => ProgramStakeholderType::class,
'entry_options' => ['label' => false],
'allow_add' => true,
'allow_delete' => true,
@@ -107,21 +107,21 @@ class InitiativeType extends AbstractType
]);
$builder->add('version', IntegerType::class, [
'label' => 'mautic.program.field.version',
'label' => 'mt3s.marketing_program.field.version',
'label_attr' => ['class' => 'control-label'],
'invalid_message' => 'mautic.program.version.range',
'invalid_message' => 'mt3s.marketing_program.version.range',
'attr' => [
'class' => 'form-control',
'min' => Initiative::VERSION_MIN,
'max' => Initiative::VERSION_MAX,
'min' => Program::VERSION_MIN,
'max' => Program::VERSION_MAX,
'step' => 1,
],
]);
// by_reference false: Symfony calls Initiative::addObjective()/removeObjective(), which keep both sides in sync.
// by_reference false: Symfony calls Program::addObjective()/removeObjective(), which keep both sides in sync.
$builder->add('objectives', CollectionType::class, [
'label' => 'mautic.program.field.objectives',
'entry_type' => InitiativeObjectiveType::class,
'label' => 'mt3s.marketing_program.field.objectives',
'entry_type' => ProgramObjectiveType::class,
'entry_options' => ['label' => false],
'allow_add' => true,
'allow_delete' => true,
@@ -132,9 +132,9 @@ class InitiativeType extends AbstractType
]);
$builder->add('status', EnumType::class, [
'class' => InitiativeStatus::class,
'choice_label' => fn (InitiativeStatus $status): string => $status->getLabelKey(),
'label' => 'mautic.program.field.status',
'class' => ProgramStatus::class,
'choice_label' => fn (ProgramStatus $status): string => $status->getLabelKey(),
'label' => 'mt3s.marketing_program.field.status',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
]);
@@ -142,7 +142,7 @@ class InitiativeType extends AbstractType
// Required here; the column is nullable only because of onDelete SET NULL.
$builder->add(
$builder->create('owner', UserListType::class, [
'label' => 'mautic.program.field.owner',
'label' => 'mt3s.marketing_program.field.owner',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'required' => true,
@@ -151,16 +151,16 @@ class InitiativeType extends AbstractType
);
$builder->add('startDate', DatePickerType::class, [
'label' => 'mautic.program.field.start_date',
'label' => 'mt3s.marketing_program.field.start_date',
]);
$builder->add('endDate', DatePickerType::class, [
'label' => 'mautic.program.field.end_date',
'label' => 'mt3s.marketing_program.field.end_date',
]);
// In the general currency (Settings > Configuration > Initiative Settings), shown next to the field.
// In the general currency (Settings > Configuration > Program Settings), shown next to the field.
$builder->add('budgetPlanned', NumberType::class, [
'label' => 'mautic.program.field.budget_planned',
'label' => 'mt3s.marketing_program.field.budget_planned',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'postaddon_text' => $this->currencyProvider->getCurrency()],
'input' => 'string',
@@ -169,7 +169,7 @@ class InitiativeType extends AbstractType
]);
$builder->add('category', CategoryListType::class, [
'bundle' => 'initiative',
'bundle' => 'program',
]);
$builder->add('isPublished', YesNoButtonGroupType::class, [
@@ -186,12 +186,12 @@ class InitiativeType extends AbstractType
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Initiative::class,
'data_class' => Program::class,
]);
}
public function getBlockPrefix(): string
{
return 'initiative';
return 'program';
}
}
+12 -12
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use MauticPlugin\ProgramBundle\Entity\Stakeholder;
use MauticPlugin\ProgramBundle\Service\ItemTypeProvider;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder;
use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider;
use Mautic\CoreBundle\Form\Type\FormButtonsType;
use Mautic\CoreBundle\Form\Type\YesNoButtonGroupType;
use Symfony\Component\Form\AbstractType;
@@ -33,38 +33,38 @@ class StakeholderType extends AbstractType
$kind = ItemTypeProvider::KIND_STAKEHOLDER;
$builder->add('name', TextType::class, [
'label' => 'mautic.program.stakeholder.field.name',
'label' => 'mt3s.marketing_program.stakeholder.field.name',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 191],
]);
$builder->add('email', EmailType::class, [
'label' => 'mautic.program.stakeholder.field.email',
'label' => 'mt3s.marketing_program.stakeholder.field.email',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 191],
'required' => false,
]);
$builder->add('phone', TelType::class, [
'label' => 'mautic.program.stakeholder.field.phone',
'label' => 'mt3s.marketing_program.stakeholder.field.phone',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 50],
'required' => false,
]);
$builder->add('role', TextType::class, [
'label' => 'mautic.program.stakeholder.field.role',
'label' => 'mt3s.marketing_program.stakeholder.field.role',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 191],
'required' => false,
]);
$builder->add('type', ChoiceType::class, [
'label' => 'mautic.program.stakeholder.field.type',
'label' => 'mt3s.marketing_program.stakeholder.field.type',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control initiative-item-type'],
'attr' => ['class' => 'form-control program-item-type'],
'choices' => $this->typeProvider->getChoices($kind),
// The type's description and pictogram, shown next to the dropdown by program.js.
// The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js.
'choice_attr' => fn (?string $key): array => [
'data-description' => (string) $this->typeProvider->getDescription($kind, $key),
'data-icon' => (string) $this->typeProvider->getIcon($kind, $key),
@@ -74,7 +74,7 @@ class StakeholderType extends AbstractType
]);
$builder->add('isPublished', YesNoButtonGroupType::class, [
'label' => 'mautic.program.stakeholder.field.active',
'label' => 'mt3s.marketing_program.stakeholder.field.active',
]);
$builder->add('buttons', FormButtonsType::class);
@@ -93,6 +93,6 @@ class StakeholderType extends AbstractType
public function getBlockPrefix(): string
{
return 'program_stakeholder';
return 'mt3s_marketing_program_stakeholder';
}
}
+18 -18
View File
@@ -2,13 +2,13 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use MauticPlugin\ProgramBundle\Entity\DependencyType;
use MauticPlugin\ProgramBundle\Entity\Initiative;
use MauticPlugin\ProgramBundle\Entity\Task;
use MauticPlugin\ProgramBundle\Entity\TaskDependency;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\DependencyType;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskDependency;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EnumType;
@@ -18,7 +18,7 @@ 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 initiative are offered; cycles and self-edges are refused by
* the relation. Only the tasks of the same program are offered; cycles and self-edges are refused by
* ValidTaskDependency.
*
* @extends AbstractType<TaskDependency>
@@ -27,23 +27,23 @@ class TaskDependencyType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
/** @var Initiative|null $initiative */
$initiative = $options['initiative'];
/** @var Program|null $program */
$program = $options['program'];
/** @var Task|null $task */
$task = $options['task'];
$builder->add('dependsOn', EntityType::class, [
'label' => 'mautic.program.task.dependency.field.depends_on',
'label' => 'mt3s.marketing_program.task.dependency.field.depends_on',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => Task::class,
'choice_label' => 'name',
'query_builder' => function (EntityRepository $er) use ($initiative, $task) {
'query_builder' => function (EntityRepository $er) use ($program, $task) {
$qb = $er->createQueryBuilder('t')
->orderBy('t.name', 'ASC');
if (null !== $initiative) {
$qb->andWhere('t.initiative = :initiative')->setParameter('initiative', $initiative);
if (null !== $program) {
$qb->andWhere('t.program = :program')->setParameter('program', $program);
}
if (null !== $task?->getId()) {
@@ -57,16 +57,16 @@ class TaskDependencyType extends AbstractType
]);
$builder->add('dependencyType', EnumType::class, [
'label' => 'mautic.program.task.dependency.field.type',
'label' => 'mt3s.marketing_program.task.dependency.field.type',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => DependencyType::class,
'choice_label' => fn (DependencyType $type): string => $type->getLabelKey(),
]);
// The row's order in the collection, rewritten by program.js after each change.
// The row's order in the collection, rewritten by mt3s-mp-program.js after each change.
$builder->add('position', HiddenType::class, [
'attr' => ['class' => 'initiative-row-position'],
'attr' => ['class' => 'program-row-position'],
]);
}
@@ -75,13 +75,13 @@ class TaskDependencyType extends AbstractType
$resolver->setDefaults([
'data_class' => TaskDependency::class,
]);
$resolver->setDefined(['initiative', 'task']);
$resolver->setAllowedTypes('initiative', [Initiative::class, 'null']);
$resolver->setDefined(['program', 'task']);
$resolver->setAllowedTypes('program', [Program::class, 'null']);
$resolver->setAllowedTypes('task', [Task::class, 'null']);
}
public function getBlockPrefix(): string
{
return 'program_task_dependency';
return 'mt3s_marketing_program_task_dependency';
}
}
+21 -21
View File
@@ -2,13 +2,13 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use MauticPlugin\ProgramBundle\Entity\Initiative;
use MauticPlugin\ProgramBundle\Entity\RaciRole;
use MauticPlugin\ProgramBundle\Entity\Stakeholder;
use MauticPlugin\ProgramBundle\Entity\TaskRaci;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\RaciRole;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Stakeholder;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskRaci;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EnumType;
@@ -18,7 +18,7 @@ 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 initiative's assigned stakeholders; several may share a role.
* The stakeholders are picked from the program's assigned stakeholders; several may share a role.
*
* @extends AbstractType<TaskRaci>
*/
@@ -26,11 +26,11 @@ class TaskRaciType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
/** @var Initiative|null $initiative */
$initiative = $options['initiative'];
/** @var Program|null $program */
$program = $options['program'];
$builder->add('role', EnumType::class, [
'label' => 'mautic.program.task.raci.field.role',
'label' => 'mt3s.marketing_program.task.raci.field.role',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => RaciRole::class,
@@ -38,20 +38,20 @@ class TaskRaciType extends AbstractType
]);
$builder->add('stakeholders', EntityType::class, [
'label' => 'mautic.program.task.raci.field.stakeholders',
'label' => 'mt3s.marketing_program.task.raci.field.stakeholders',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => Stakeholder::class,
'choice_label' => 'name',
'query_builder' => function (EntityRepository $er) use ($initiative) {
'query_builder' => function (EntityRepository $er) use ($program) {
$qb = $er->createQueryBuilder('s')
->orderBy('s.name', 'ASC');
// The initiative's assigned stakeholders, when the initiative is known.
if (null !== $initiative) {
$qb->join('s.initiativeLinks', 'l')
->andWhere('l.initiative = :initiative')
->setParameter('initiative', $initiative);
// The program's assigned stakeholders, when the program is known.
if (null !== $program) {
$qb->join('s.programLinks', 'l')
->andWhere('l.program = :program')
->setParameter('program', $program);
}
return $qb;
@@ -61,9 +61,9 @@ class TaskRaciType extends AbstractType
'required' => false,
]);
// The row's order in the collection, rewritten by program.js after each change.
// The row's order in the collection, rewritten by mt3s-mp-program.js after each change.
$builder->add('position', HiddenType::class, [
'attr' => ['class' => 'initiative-row-position'],
'attr' => ['class' => 'program-row-position'],
]);
}
@@ -72,12 +72,12 @@ class TaskRaciType extends AbstractType
$resolver->setDefaults([
'data_class' => TaskRaci::class,
]);
$resolver->setDefined(['initiative']);
$resolver->setAllowedTypes('initiative', [Initiative::class, 'null']);
$resolver->setDefined(['program']);
$resolver->setAllowedTypes('program', [Program::class, 'null']);
}
public function getBlockPrefix(): string
{
return 'program_task_raci';
return 'mt3s_marketing_program_task_raci';
}
}
+28 -28
View File
@@ -2,16 +2,16 @@
declare(strict_types=1);
namespace MauticPlugin\ProgramBundle\Form\Type;
namespace MauticPlugin\MT3SMarketingProgramBundle\Form\Type;
use Doctrine\ORM\EntityRepository;
use Mautic\CoreBundle\Form\EventListener\CleanFormSubscriber;
use Mautic\CoreBundle\Form\Type\FormButtonsType;
use MauticPlugin\ProgramBundle\Entity\Initiative;
use MauticPlugin\ProgramBundle\Entity\Task;
use MauticPlugin\ProgramBundle\Entity\TaskKind;
use MauticPlugin\ProgramBundle\Entity\TaskStatus;
use MauticPlugin\ProgramBundle\Service\ItemTypeProvider;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Program;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\Task;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskKind;
use MauticPlugin\MT3SMarketingProgramBundle\Entity\TaskStatus;
use MauticPlugin\MT3SMarketingProgramBundle\Service\ItemTypeProvider;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -46,7 +46,7 @@ class TaskType extends AbstractType
/** @var Task $task */
$task = $options['data'];
$initiative = $task->getInitiative();
$program = $task->getProgram();
$kind = ItemTypeProvider::KIND_TASK;
@@ -54,7 +54,7 @@ class TaskType extends AbstractType
$taskKind = $task->getTaskKind();
$builder->add('taskKind', EnumType::class, [
'label' => 'mautic.program.task.field.kind',
'label' => 'mt3s.marketing_program.task.field.kind',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => TaskKind::class,
@@ -62,11 +62,11 @@ class TaskType extends AbstractType
]);
$builder->add('type', ChoiceType::class, [
'label' => 'mautic.program.task.field.type',
'label' => 'mt3s.marketing_program.task.field.type',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control initiative-item-type'],
'attr' => ['class' => 'form-control program-item-type'],
'choices' => $this->typeProvider->getChoices($kind),
// The type's description and pictogram, shown next to the dropdown by program.js.
// The type's description and pictogram, shown next to the dropdown by mt3s-mp-program.js.
'choice_attr' => fn (?string $key): array => [
'data-description' => (string) $this->typeProvider->getDescription($kind, $key),
'data-icon' => (string) $this->typeProvider->getIcon($kind, $key),
@@ -76,23 +76,23 @@ class TaskType extends AbstractType
]);
$builder->add('name', TextType::class, [
'label' => 'mautic.program.task.field.name',
'label' => 'mt3s.marketing_program.task.field.name',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'maxlength' => 255],
]);
$builder->add('description', TextareaType::class, [
'label' => 'mautic.program.task.field.description',
'label' => 'mt3s.marketing_program.task.field.description',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 6],
'required' => false,
]);
$builder->add('initiative', EntityType::class, [
'label' => 'mautic.program.task.field.initiative',
$builder->add('program', EntityType::class, [
'label' => 'mt3s.marketing_program.task.field.program',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => Initiative::class,
'class' => Program::class,
'choice_label' => 'name',
'query_builder' => fn (EntityRepository $er) => $er->createQueryBuilder('p')->orderBy('p.name', 'ASC'),
'placeholder' => 'mautic.core.form.chooseone',
@@ -101,7 +101,7 @@ class TaskType extends AbstractType
// Simple dates, no time (the columns are DATE since 0.13.0).
$builder->add('startDate', DateType::class, [
'label' => 'mautic.program.task.field.start_date',
'label' => 'mt3s.marketing_program.task.field.start_date',
'widget' => 'single_text',
'format' => 'yyyy-MM-dd',
'html5' => true,
@@ -112,7 +112,7 @@ class TaskType extends AbstractType
$isMilestone = TaskKind::Milestone === $task->getTaskKind();
$isPhase = TaskKind::Phase === $task->getTaskKind();
$builder->add('endDate', DateType::class, [
'label' => 'mautic.program.task.field.end_date',
'label' => 'mt3s.marketing_program.task.field.end_date',
'widget' => 'single_text',
'format' => 'yyyy-MM-dd',
'html5' => true,
@@ -123,7 +123,7 @@ class TaskType extends AbstractType
// Status: a phase has none of its own — it comes from its tasks.
if (!$isPhase) {
$builder->add('status', EnumType::class, [
'label' => 'mautic.program.task.field.status',
'label' => 'mt3s.marketing_program.task.field.status',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control'],
'class' => TaskStatus::class,
@@ -132,26 +132,26 @@ class TaskType extends AbstractType
}
$builder->add('definitionOfDone', TextareaType::class, [
'label' => 'mautic.program.task.field.definition_of_done',
'label' => 'mt3s.marketing_program.task.field.definition_of_done',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'rows' => 3],
'required' => false,
]);
$builder->add('plannedWork', IntegerType::class, [
'label' => 'mautic.program.task.field.planned_work',
'label' => 'mt3s.marketing_program.task.field.planned_work',
'label_attr' => ['class' => 'control-label'],
'attr' => ['class' => 'form-control', 'min' => 0, 'step' => 1, 'postaddon_text' => 'h'],
'required' => false,
]);
// Dependencies: several edges, each another task of the initiative with the relation type. The
// Dependencies: several edges, each another task of the program with the relation type. The
// rows are added and removed by the form template; cycles and self-edges are refused by
// ValidTaskDependency.
$builder->add('dependencies', CollectionType::class, [
'label' => 'mautic.program.task.field.dependencies',
'label' => 'mt3s.marketing_program.task.field.dependencies',
'entry_type' => TaskDependencyType::class,
'entry_options' => ['label' => false, 'initiative' => $initiative, 'task' => $task],
'entry_options' => ['label' => false, 'program' => $program, 'task' => $task],
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
@@ -160,11 +160,11 @@ class TaskType extends AbstractType
'required' => false,
]);
// RACI: one row per role, several stakeholders per role, picked from the initiative's stakeholders.
// RACI: one row per role, several stakeholders per role, picked from the program's stakeholders.
$builder->add('raci', CollectionType::class, [
'label' => 'mautic.program.task.field.raci',
'label' => 'mt3s.marketing_program.task.field.raci',
'entry_type' => TaskRaciType::class,
'entry_options' => ['label' => false, 'initiative' => $initiative],
'entry_options' => ['label' => false, 'program' => $program],
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
@@ -189,6 +189,6 @@ class TaskType extends AbstractType
public function getBlockPrefix(): string
{
return 'program_task';
return 'mt3s_marketing_program_task';
}
}