Skip to content

docs: Port "Integrations" extension page to 7.2 - #590

Open
promptless-for-oss wants to merge 2 commits into
mautic:7.2from
Promptless:promptless/docs-issue-329-integrations-7.2
Open

docs: Port "Integrations" extension page to 7.2#590
promptless-for-oss wants to merge 2 commits into
mautic:7.2from
Promptless:promptless/docs-issue-329-integrations-7.2

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

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


Tip: Sort by Shortest Review in the Dashboard to find quick wins ⚡

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:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Source: https://github.com/mautic/developer-documentation/blob/main/source/includes/_plugin_extending_integrations.md

Comment thread docs/plugin_extensions/integrations.rst Outdated

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 adiati98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@promptless-for-oss please address the suggestions.

Please check for any passive voice in this PR and turn them into active voice.

Comment on lines 4 to +14
.. 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the note.

Comment thread docs/plugin_extensions/integrations.rst Outdated
Comment on lines +18 to +20
.. 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap this note admonition in vale off/on statements.

Comment thread docs/plugin_extensions/integrations.rst Outdated
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``.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'
Suggested change
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``.

Comment thread docs/plugin_extensions/integrations.rst Outdated
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use active instead of passive voice. See: 'is defined' and 'isn't required'

Comment thread docs/plugin_extensions/integrations.rst Outdated

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address the Vale warning:

  • [Google.Passive] In general, use active voice instead of passive voice ('are encrypted').

Comment thread docs/plugin_extensions/integrations.rst Outdated
- 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.

Comment thread docs/plugin_extensions/integrations.rst Outdated
- 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``.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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``.

Comment thread docs/plugin_extensions/integrations.rst Outdated
- Determines whether the Integration has been configured correctly.
* - General
- ``isAuthorized``
- Determines whether the Integration is authorized, reauthorizing when an OAuth2 refresh token is stored.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use active instead of passive voice. See: 'is authorized' and 'is stored'.

Comment thread docs/plugin_extensions/integrations.rst Outdated
- 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use active instead of passive voice. See: 'they're appended'

Comment thread docs/plugin_extensions/integrations.rst Outdated
- The request method - ``GET``, ``POST``, ``PUT``, ``PATCH``, or ``DELETE``.
* - ``$settings``
- array
- Configures the behavior of ``makeRequest()``. Built-in optional settings are listed below.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review, @adiati98 — all of your comments have been addressed on the branch:

  • Removed the legacy update-notice note and wrapped the AbstractIntegration framework-pointer note in .. vale off/.. vale on.
  • Converted the flagged passive-voice sentences to active voice, and swept the rest of the PR for passive voice as you asked (including the isConfigured and encode_parameters table rows).
  • Applied both suggestion blocks verbatim (single quotes on getClientIdKey/getClientSecretKey).
  • Fixed the 128x128 px spacing, capitalized Form for feature consistency, and changed that isthat's.
  • Added PNG to the Vale vocabulary (accept.txt).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants