docs: Port "Integrations" extension page to 7.2 - #590
Conversation
Ports the legacy AbstractIntegration guide from the legacy developer-documentation repo into docs/plugin_extensions/integrations.rst, converting Markdown to RST and pointing readers to the modern Integrations framework. Resolves docs issue mautic#329 (content from mautic#328), targeting the 7.2 base branch. Ref: mautic#329, mautic#328
| Integration class | ||
| ***************** | ||
|
|
||
| A Plugin can provide multiple Integrations, each defined as its own class in the bundle's ``Integration`` folder. The class extends ``Mautic\PluginBundle\Integration\AbstractIntegration``, which provides many helper methods, including OAuth authorization and request signing: |
There was a problem hiding this comment.
Ported the Integration class, Integration image, Authorization, Functions, and makeRequest sections plus the MarsIntegration example from the legacy _plugin_extending_integrations.md source, cleaning up the duplicated <?php line and the missing semicolon after return 'Red Mars' and adding PHP return types per the org style guide.
|
|
||
| .. note:: | ||
|
|
||
| This page covers the legacy ``AbstractIntegration`` approach. New Integrations should use the :doc:`Integrations framework</plugin_integrations/integrations>`, which separates authentication, configuration, and sync concerns into dedicated interfaces. |
There was a problem hiding this comment.
Issue #328 (parent of #329) supplied the legacy source URL and the "transfer the content under the note admonition" guidance, so the ported content is placed under the existing .. note:: placeholder and the legacy AbstractIntegration approach is cross-linked to the modern plugin_integrations/integrations framework page.
Source: #328
adiati98
left a comment
There was a problem hiding this comment.
@promptless-for-oss please address the suggestions.
Please check for any passive voice in this PR and turn them into active voice.
| .. vale off | ||
|
|
||
| .. 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 :xref:`legacy repository`. | ||
|
|
||
| If you're interested in helping develop the new content for this page and others, consider joining the documentation efforts. | ||
|
|
||
| Please read the :xref:`dev docs contributing guidelines` and :xref:`Contributing to Mautic’s documentation` to get started. | ||
|
|
||
| .. vale on | ||
| .. vale on |
| .. note:: | ||
|
|
||
| This page covers the legacy ``AbstractIntegration`` approach. New Integrations should use the :doc:`Integrations framework</plugin_integrations/integrations>`, which separates authentication, configuration, and sync concerns into dedicated interfaces. |
There was a problem hiding this comment.
Wrap this note admonition in vale off/on statements.
| Integration image | ||
| ***************** | ||
|
|
||
| Each Integration is displayed on a card in the 'Manage Plugins' area. To set its image, add a 128x128px PNG to the bundle's ``Assets/img`` folder, named after the value returned by ``getName()`` in lowercase. For example, ``MarsIntegration`` uses ``plugins/HelloWorldBundle/Assets/img/mars.png``. |
There was a problem hiding this comment.
There are a few things here:
- Add PNG to accept.txt file
- Address Vale warning: [Google.Passive] In general, use active voice instead of passive voice ('is displayed').
- Add a space for '128x128 px'
| Each Integration is displayed on a card in the 'Manage Plugins' area. To set its image, add a 128x128px PNG to the bundle's ``Assets/img`` folder, named after the value returned by ``getName()`` in lowercase. For example, ``MarsIntegration`` uses ``plugins/HelloWorldBundle/Assets/img/mars.png``. | |
| Each Integration is displayed on a card in the 'Manage Plugins' area. To set its image, add a 128x128 px PNG to the bundle's ``Assets/img`` folder, named after the value returned by ``getName()`` in lowercase. For example, ``MarsIntegration`` uses ``plugins/HelloWorldBundle/Assets/img/mars.png``. |
| Authorization | ||
| ************* | ||
|
|
||
| Out of the box, ``AbstractIntegration`` handles the standard key, OAuth1a, and OAuth2 specifications. The ``getAuthenticationType()`` method defines which one to use. Each input the User must provide - username, password, and so on - is defined by an array of ``keyName => label`` elements returned by ``getRequiredKeyFields()``. That method isn't required when you use one of the standard specifications. |
There was a problem hiding this comment.
Use active instead of passive voice. See: 'is defined' and 'isn't required'
|
|
||
| Out of the box, ``AbstractIntegration`` handles the standard key, OAuth1a, and OAuth2 specifications. The ``getAuthenticationType()`` method defines which one to use. Each input the User must provide - username, password, and so on - is defined by an array of ``keyName => label`` elements returned by ``getRequiredKeyFields()``. That method isn't required when you use one of the standard specifications. | ||
|
|
||
| Keys saved by the Integration are encrypted. To access the decrypted values inside the Integration class, use the ``$this->keys`` array. You can override any method defined in ``AbstractIntegration`` to suit the Integration's needs. |
There was a problem hiding this comment.
Address the Vale warning:
- [Google.Passive] In general, use active voice instead of passive voice ('are encrypted').
| - Returns any ``keyName`` from ``getRequiredKeyFields`` that is secret, so it's masked in the form. | ||
| * - Auth & Request | ||
| - ``getClientIdKey`` | ||
| - Defines the "username" for the Integration. Defaults to ``client_id`` for OAuth2 and ``keyName`` for the key authentication type. |
There was a problem hiding this comment.
| - Defines the "username" for the Integration. Defaults to ``client_id`` for OAuth2 and ``keyName`` for the key authentication type. | |
| - Defines the 'username' for the Integration. Defaults to ``client_id`` for OAuth2 and ``keyName`` for the key authentication type. |
| - Defines the "username" for the Integration. Defaults to ``client_id`` for OAuth2 and ``keyName`` for the key authentication type. | ||
| * - Auth & Request | ||
| - ``getClientSecretKey`` | ||
| - Defines the "password" for the Integration. By default, only OAuth2 uses this and returns ``client_secret``. |
There was a problem hiding this comment.
| - Defines the "password" for the Integration. By default, only OAuth2 uses this and returns ``client_secret``. | |
| - Defines the 'password' for the Integration. By default, only OAuth2 uses this and returns ``client_secret``. |
| - Determines whether the Integration has been configured correctly. | ||
| * - General | ||
| - ``isAuthorized`` | ||
| - Determines whether the Integration is authorized, reauthorizing when an OAuth2 refresh token is stored. |
There was a problem hiding this comment.
Use active instead of passive voice. See: 'is authorized' and 'is stored'.
| - The URL to make the request to. | ||
| * - ``$parameters`` | ||
| - array | ||
| - Parameters to submit with the request. For a ``GET`` request they're appended to the query string; otherwise they form the POST body. |
There was a problem hiding this comment.
Use active instead of passive voice. See: 'they're appended'
| - The request method - ``GET``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``. | ||
| * - ``$settings`` | ||
| - array | ||
| - Configures the behavior of ``makeRequest()``. Built-in optional settings are listed below. |
There was a problem hiding this comment.
Use active instead of passive voice. See: 'are listed'.
Apply @adiati98 review comments on PR mautic#590: - Remove the legacy 'requires a major update' note; lead with the intro paragraph - Wrap the legacy AbstractIntegration note in vale off/on - Convert flagged passive voice to active voice across the page - Apply reviewer verbatim single-quote fixes on getClientIdKey/getClientSecretKey - Fix '128x128 px' spacing; capitalize 'Form' feature references - Add PNG and px to the Mautic Vale vocabulary
|
Thanks for the thorough review, @adiati98 — all of your comments have been addressed on the branch:
Vale now passes with no errors or warnings. Two remaining Vale suggestions are intentional: 'is displayed' is kept exactly as your suggestion block worded it, and "they form the POST body" is a false positive since 'form' there is a verb. Ready for another look. |
Open this suggestion in Promptless to view citations and reasoning process
Ports the legacy AbstractIntegration guide from the legacy developer-documentation repo into docs/plugin_extensions/integrations.rst, converting Markdown to RST with a pointer to the modern Integrations framework. Targets the 7.2 base branch. Resolves docs issue #329 (content from parent #328).
Trigger Events
blockedlabel is to set content, structure, and tone in one branch, then backport/cherry pick i...Tip: Sort by Shortest Review in the Dashboard to find quick wins ⚡