Integration configuration Form notes
Note
The content for this page requires a major update. The legacy page contains outdated and potentially inaccurate information. You can still access it in the Mautic Developer Documentation archived repository.
If you’re interested in helping develop the new content for this page and others, consider joining the documentation efforts.
Please read the Contributing Guidelines and Contributing to Mautic’s documentation to get started.
The Integration framework lets developer define their custom messages for the Plugin’s configuration Form.
The ConfigSupport class should implement the \Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormNotesInterface
- interface \Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormNotesInterface
- public function getAuthorizationNote(): ?Note
- Returns:
The message and type for Auth tab.
- Return type:
Note
- public function getFeaturesNote(): ?Note
- Returns:
The message and type for Features tab.
- Return type:
Note
- public function getFieldMappingNote(): ?Note
- Returns:
The message and type for Field Mapping tab.
- Return type:
Note
Note Object
- class \Mautic\IntegrationsBundle\DTO\Note
- public note;
- public type;
- public function getNote(): string
- Returns:
The string to display.
- Return type:
string
- public function getType(): string
- Returns:
The note type, this helps annotate the note.
- Return type:
string
The following code snippet shows the use of \Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormNotesInterface.
<?php declare(strict_types=1); namespace MauticPlugin\HelloWorldBundle\Integration\Support; use Mautic\IntegrationsBundle\DTO\Note; use Mautic\IntegrationsBundle\Integration\ConfigFormNotesTrait; use Mautic\IntegrationsBundle\Integration\DefaultConfigFormTrait; use Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormAuthInterface; use Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormFeatureSettingsInterface; use Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormFeaturesInterface; use Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormInterface; use Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormNotesInterface; use Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormSyncInterface; use MauticPlugin\HelloWorldBundle\Form\Type\ConfigAuthType; use MauticPlugin\HelloWorldBundle\Form\Type\ConfigFeaturesType; use MauticPlugin\HelloWorldBundle\Integration\HelloWorldIntegration; class ConfigSupport extends HelloWorldIntegration implements ConfigFormInterface, ConfigFormAuthInterface, ConfigFormFeatureSettingsInterface, ConfigFormSyncInterface, ConfigFormFeaturesInterface, ConfigFormNotesInterface { use DefaultConfigFormTrait; use ConfigFormNotesTrait; public function getAuthConfigFormName(): string { return ConfigAuthType::class; } public function getFeatureSettingsConfigFormName(): string { return ConfigFeaturesType::class; } // ... /** * Adds message to the Enable/Auth tab. */ public function getAuthorizationNote(): ?Note { return new Note('Additional information for Authorization tab.', Note::TYPE_INFO); } /** * Adds message to the Features tab. */ public function getFeaturesNote(): ?Note { return new Note('Warning message for Features tab.', Note::TYPE_WARNING); } /** * Adds message to the Field Mapping tabs. */ public function getFieldMappingNote(): ?Note { return new Note('Additional information for Field mapping tab.', Note::TYPE_INFO); } }
Additional information
The trait
Mautic\IntegrationsBundle\Integration\ConfigFormNotesTraithelps define the defaultnull.Instead of plain string, one can pass the translation key which holds the message. for example
new Note('helloworld.config.auth_tab', Note::TYPE_INFO);