You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plugins/config.rst
+3-13Lines changed: 3 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,8 +129,6 @@ Route definitions
129
129
130
130
Route definitions define the route's method, path, controller, parameters, and others defined below.
131
131
132
-
133
-
134
132
.. list-table::
135
133
:header-rows: 1
136
134
:widths: 28 20 25 60
@@ -288,7 +286,6 @@ Plugins define items for Mautic's varying menus through the ``menu`` config arra
288
286
289
287
// ...
290
288
291
-
292
289
Available menus
293
290
===============
294
291
@@ -690,7 +687,6 @@ Use ``categories`` to define Category types available to the Category manager. S
690
687
691
688
// ...
692
689
693
-
694
690
Parameters config items
695
691
***********************
696
692
@@ -709,18 +705,16 @@ Configure parameters that are consumable through Mautic's ``CoreParameterHelper`
709
705
710
706
// ...
711
707
712
-
713
708
.. note:: The default value must match the value's type for Mautic to typecast and transform appropriately. For example, if there isn't a specific default value to declare, define an empty array, ``[]``, for an array type; zero, ``0``, for an integer type; ``TRUE`` or ``FALSE`` for boolean types; and so forth. Services leveraging parameters should accept and handle ``NULL`` for integer and string types, excluding ``0``.
714
709
715
710
.. note:: Parameters aren't exposed to the UI by default. See :ref:`components/config:Configuration` for more information.
716
711
717
-
718
712
Custom config parameters
719
713
************************
720
714
721
715
You can define custom configuration parameters in your Plugin to support configurable features, such as enabling or disabling functions.
722
716
723
-
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.
717
+
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.
724
718
725
719
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.
726
720
@@ -734,7 +728,6 @@ To add these configuration options in Mautic's configuration section, you’ll n
734
728
735
729
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.
736
730
737
-
738
731
Config event subscriber
739
732
=======================
740
733
@@ -791,7 +784,6 @@ The following code example shows how a Plugin structures its event subscriber.
791
784
}
792
785
}
793
786
794
-
795
787
Subscribed events
796
788
-----------------
797
789
@@ -803,9 +795,9 @@ The event subscriber listens to the following events:
803
795
- ``ConfigEvents::CONFIG_PRE_SAVE``:
804
796
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``.
805
797
806
-
Generate plugin configuration
798
+
Generate Plugin configuration
807
799
-----------------------------
808
-
.. vale on
800
+
809
801
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:
810
802
811
803
.. list-table::
@@ -820,7 +812,6 @@ To register Plugin’s configuration details during the ``ConfigEvents::CONFIG_O
820
812
- The view that formats the configuration form elements, for example, ``HelloWorldBundle:FormTheme\Config``.
821
813
* - ``parameters``
822
814
- An array of custom configuration elements. ``Use $event->getParametersFromConfig('HelloWorldBundle')`` to retrieve them from the plugin’s configuration file.
823
-
.. vale off
824
815
825
816
Modify configuration before saving
826
817
----------------------------------
@@ -832,7 +823,6 @@ Register the event subscriber
832
823
833
824
Register the subscriber through the Plugin’s configuration in the ``services[events]`` in :ref:`plugins/config:Service config items`. This ensures that the plugin listens for the events and reacts accordingly.
0 commit comments