Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for component integration. #77

Merged
merged 31 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2d1d70d
Documentation for plugins configuration.
shinde-rahul Oct 14, 2022
9cd9730
Added integration related configurations.
shinde-rahul Oct 16, 2022
eb91308
Updated gitignore.
shinde-rahul Oct 16, 2022
88350f4
corrected vale errors.
shinde-rahul Oct 16, 2022
8b6f3a7
Added ConfigFormNotesInterface page.
shinde-rahul Oct 17, 2022
b930319
add email testing
mabumusa1 May 31, 2022
30527e9
add the insturctions
mabumusa1 May 31, 2022
1987862
Fix indentation
RCheesley Oct 6, 2022
9218d79
Added ConfigFormNotesInterface page.
shinde-rahul Oct 17, 2022
939dd6a
Sync with base branch.
shinde-rahul Oct 17, 2022
5b34119
Removed dead reference
shinde-rahul Oct 17, 2022
3792327
Apply suggestions from code review
shinde-rahul Oct 18, 2022
4b0d80e
Updated structure for docs
shinde-rahul Oct 25, 2022
33dd30d
Corrected URLs
shinde-rahul Oct 25, 2022
c5fca3d
Added link files for external links.
shinde-rahul Oct 25, 2022
fe9804d
Corrected RST.
shinde-rahul Oct 25, 2022
1bf805d
Change word to display.
shinde-rahul Oct 25, 2022
7b8307c
Added basic page and corrected the structure.
shinde-rahul Oct 27, 2022
9be8d15
Corrected heading and merged docs.
shinde-rahul Oct 28, 2022
39901ec
Addressed vale warnings.
shinde-rahul Oct 28, 2022
20eeaed
Reword and addressed a few doable vale's suggestions.
shinde-rahul Oct 28, 2022
49794a7
Updated form notes docs.
shinde-rahul Oct 28, 2022
418c7b4
Update headings.
shinde-rahul Oct 30, 2022
14990b8
Corrected namespace.
shinde-rahul Oct 31, 2022
5d3c586
Corrected header for correct referencing.
shinde-rahul Oct 31, 2022
ebd7672
Rearranged the docs for better fitment.
shinde-rahul Nov 2, 2022
ce0e7bc
Corrected doc references.
shinde-rahul Nov 2, 2022
a030b90
Merge branch '5.x' into plugin-configuration-5-x
shinde-rahul Jan 25, 2023
f342a2e
Removed bad lines and fixed vale errors.
shinde-rahul Jan 25, 2023
2cacedf
Fixed vale errors.
shinde-rahul Jan 25, 2023
c8dfb6d
Fixed vale errors.
shinde-rahul Jan 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/components/integrations_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,14 @@ Contact/Company syncing interfaces
The IntegrationsBundle provides a sync framework for third party services to sync with Mautic's Contacts and Companies. The ``\Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormSyncInterface`` determines the configuration options for this sync feature. Refer to the method DocBlocks in the interface for more details.

Read more about how to leverage the :doc:`sync framework<integrations_sync>`.

.. vale off

Config Form notes interface
===========================

.. vale on

The interface, ``\Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormNotesInterface``, provides a way to display notes, either info or warning, on the Plugin configuration Form.

Read more about to how-tos :doc:`here<integrations_configuration_form_notes>`
126 changes: 126 additions & 0 deletions docs/components/integrations_configuration_form_notes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
.. It is a reference only page, not a part of doc tree.

:orphan:

.. vale off

Integration configuration form notes
####################################

.. vale on

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``

.. php:interface:: \Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormNotesInterface

.. php:method:: public function getAuthorizationNote(): ?Note

:return: The message and type for Auth tab.
:returntype: :ref:`Note<Note Object>`

.. php:method:: public function getFeaturesNote(): ?Note

:return: The message and type for Features tab.
:returntype: :ref:`Note<Note Object>`

.. php:method:: public function getFieldMappingNote(): ?Note

:return: The message and type for Field Mapping tab.
:returntype: :ref:`Note<Note Object>`

_____

.. vale off

Note Object
***********

.. vale:on

.. php:class:: \Mautic\IntegrationsBundle\DTO\Note

.. php:attr:: public note;

.. php:attr:: public type;

.. php:method:: public function getNote(): string

:return: The string to display.
:returntype: string

.. php:method:: public function getType(): string

:return: The note type, this helps annotate the note.
:returntype: string

The following code snippet shows the use of ``\Mautic\IntegrationsBundle\Integration\Interfaces\ConfigFormNotesInterface``.

.. code-block:: php

<?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);
}
}

.. admonition:: Additional information

- The trait ``Mautic\IntegrationsBundle\Integration\ConfigFormNotesTrait`` helps define the default ``null``.
- 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);``
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ This is a work in progress. More to come soon. In the meantime, go to :xref:`Leg
plugins/autowiring
plugins/mautic_vs_symfony
plugins/dependencies
plugins/event_listeners
plugins/structure
plugins/config
plugins/event_listeners
plugins/installation
plugins/data
plugins/translations
Expand Down