Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/links/mautic_dev_contribution_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

link_name = "Mautic Developer Contribution Guide"
link_text = "Mautic Developer Contribution Guide"
link_url = "https://contribute.mautic.org/contributing-to-mautic/developer"
link_url = "https://contribute.mautic.org/en/latest/contributing/developer.html"

link.xref_links.update({link_name: (link_text, link_url)})
41 changes: 34 additions & 7 deletions docs/plugins/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ Mautic recognizes the Plugin through the general config options.
Routing config items
********************

.. vale off

Routes define the URL paths that execute the specified controller action. Register routes with Mautic through the ``routes`` key in the Plugin's config. Define each route under one of Mautic's :ref:`supported firewalls<plugins/config:Routing firewalls>` with a uniquely identifying key and the :ref:`route's definition<plugins/config:Route definitions>`.

.. vale on

.. code-block:: php

<?php
Expand Down Expand Up @@ -129,8 +133,6 @@ Route definitions

Route definitions define the route's method, path, controller, parameters, and others defined below.



.. list-table::
:header-rows: 1
:widths: 28 20 25 60
Expand Down Expand Up @@ -199,9 +201,13 @@ Configure custom routes through writing a listener to the ``\Mautic\CoreBundle\C

.. php:method:: getType()

.. vale off
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you can use Vale within the php class/method - this text seems to be missing:

image

Probs need to use it before the method declaration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked my changes, and it's the same with the live website. So they all actually broken.
Maybe let's just remove the vale here. Might give some errors, but it's because of the code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is weird. I removed the vale statements completely from here, but the result is still the same as your screenshot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not familiar with php.
But can you confirm that the whole block is php code block?

.. php:class:: Mautic\CoreBundle\Event\RouteEvent

  .. php:method:: getType()

      :returns: The :ref:`route firewall<plugins/config:Routing firewalls>` for the given route collection.
      :returntype: string

  .. php:method:: getCollection()

      :returns: Returns a RouteCollection object that can be used to manually define custom routes.
      :returntype: \\Symfony\\Component\\Routing\\RouteCollection

  .. php:method:: addRoutes(string $path)

      Load custom routes through a resource file such as yaml or XML.

      :param string $path: Path to the resource file. For example, ``@FMElfinderBundle/Resources/config/routing.yaml``.
      :returntype: void

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If so, I think I know where it's gone wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed the vale off/on. I'm not sure how these RST syntax should be rendered on the site, though. I'm asking confirmation from Rahul on Slack.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "rendering problem" has been fixed in #269. 👍🏼


:returns: The :ref:`route firewall<plugins/config:Routing firewalls>` for the given route collection.
:returntype: string

.. vale on

.. php:method:: getCollection()

:returns: Returns a RouteCollection object that can be used to manually define custom routes.
Expand Down Expand Up @@ -288,7 +294,6 @@ Plugins define items for Mautic's varying menus through the ``menu`` config arra

// ...


Available menus
===============

Expand Down Expand Up @@ -324,6 +329,8 @@ Menu item definitions

Define items in an ``items`` array along with ``priority`` or at the root of the menu's array.

.. vale off

Key each item with its respective :ref:`language string key<plugins/translations:Translating plugins>`.

.. list-table::
Expand Down Expand Up @@ -367,6 +374,8 @@ Key each item with its respective :ref:`language string key<plugins/translations
- string
- Font Awesome class to set the icon for the menu item.

.. vale on

Menu item checks
----------------

Expand Down Expand Up @@ -422,8 +431,12 @@ Supported checks are ``parameters``, ``request``, and ``integration``.

// ...

.. vale off

Of course, you can also combine multiple checks. All must evaluate to TRUE to display the item.

.. vale on

.. code-block:: php

<?php
Expand Down Expand Up @@ -495,6 +508,8 @@ Service types

For convenience, Mautic auto-tags services defined within specific keys.

.. vale off

.. list-table::
:header-rows: 1
:widths: 15 15 50
Expand Down Expand Up @@ -524,11 +539,15 @@ For convenience, Mautic auto-tags services defined within specific keys.
- n/a
- You can use any other key you want to organize services in the config array. Note that this could risk incompatibility with a future version of Mautic if using something generic that Mautic starts to use as well.

.. vale on

Service definitions
===================

Key each service with a unique name to all of Mautic, including other Plugins.

.. vale off

.. list-table::
:header-rows: 1
:widths: 25 17 15 50
Expand Down Expand Up @@ -606,6 +625,8 @@ Key each service with a unique name to all of Mautic, including other Plugins.
- boolean
- Define the service with lazy loading. Symfony ignores this until Mautic addresses https://forum.mautic.org/t/supporty-symfony-lazy-services/21923.

.. vale on

Mautic service tags
-------------------

Expand Down Expand Up @@ -720,7 +741,9 @@ Custom config parameters

You can define custom configuration parameters in your Plugin to support configurable features, such as enabling or disabling functions.

Mautic Plugins allow you to define these parameters for use within your Plugin’s code. Store these parameters in ``config/local.php``, and define their default values in the Plugin’s own config file to ensure stability and avoid errors.
Mautic Plugins allow you to define these parameters for use within your Plugin’s code. Store these parameters in ``config/local.php``, and define their default values in the Plugin’s own config file to ensure stability and avoid errors.

.. vale off

To avoid errors during cache compilation or when accessing parameters directly from the container without checking for their existence, always define custom parameters in the :ref:`plugins/config:Parameters config items`. This guarantees that the parameter exists and has a fallback value.

Expand All @@ -730,14 +753,19 @@ To add these configuration options in Mautic's configuration section, you’ll n
- A :doc:`Form type </components/forms>` that defines the fields.
- A specific view for rendering the form.

.. vale on

.. note::

To translate the Plugin’s tab label in the configuration form, include a translation key like ``mautic.config.tab.helloworld_config`` in the Plugin’s ``messages.ini`` file. Replace ``helloworld_config`` with the ``formAlias`` used when registering the form in the event subscriber.

.. vale off

Config event subscriber
=======================

.. vale on

This allows Plugins to interact with Mautic's configuration events. It listens to two important events: ``ConfigEvents::CONFIG_ON_GENERATE`` and ``ConfigEvents::CONFIG_PRE_SAVE``.

The following code example shows how a Plugin structures its event subscriber.
Expand Down Expand Up @@ -791,7 +819,6 @@ The following code example shows how a Plugin structures its event subscriber.
}
}


Subscribed events
-----------------

Expand All @@ -803,9 +830,9 @@ The event subscriber listens to the following events:
- ``ConfigEvents::CONFIG_PRE_SAVE``:
Mautic triggers this event before it renders the form values and saves them to the ``local.php`` file. This allows the Plugin to clean up or modify the data before writing it to ``local.php``.

Generate plugin configuration
Generate Plugin configuration
-----------------------------
.. vale on

To register Plugin’s configuration details during the ``ConfigEvents::CONFIG_ON_GENERATE event``, call the ``addForm()`` method on the ``ConfigBuilderEvent`` object. The method expects an array with the following elements:

.. list-table::
Expand Down