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
-33Lines changed: 0 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,12 +43,8 @@ Mautic recognizes the Plugin through the general config options.
43
43
Routing config items
44
44
********************
45
45
46
-
.. vale off
47
-
48
46
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>`.
49
47
50
-
.. vale on
51
-
52
48
.. code-block:: php
53
49
54
50
<?php
@@ -325,8 +321,6 @@ Menu item definitions
325
321
326
322
Define items in an ``items`` array along with ``priority`` or at the root of the menu's array.
327
323
328
-
.. vale off
329
-
330
324
Key each item with its respective :ref:`language string key<plugins/translations:Translating plugins>`.
331
325
332
326
.. list-table::
@@ -370,8 +364,6 @@ Key each item with its respective :ref:`language string key<plugins/translations
370
364
- string
371
365
- Font Awesome class to set the icon for the menu item.
372
366
373
-
.. vale on
374
-
375
367
Menu item checks
376
368
----------------
377
369
@@ -427,12 +419,8 @@ Supported checks are ``parameters``, ``request``, and ``integration``.
427
419
428
420
// ...
429
421
430
-
.. vale off
431
-
432
422
Of course, you can also combine multiple checks. All must evaluate to TRUE to display the item.
433
423
434
-
.. vale on
435
-
436
424
.. code-block:: php
437
425
438
426
<?php
@@ -504,8 +492,6 @@ Service types
504
492
505
493
For convenience, Mautic auto-tags services defined within specific keys.
506
494
507
-
.. vale off
508
-
509
495
.. list-table::
510
496
:header-rows: 1
511
497
:widths: 15 15 50
@@ -535,15 +521,11 @@ For convenience, Mautic auto-tags services defined within specific keys.
535
521
- n/a
536
522
- 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.
537
523
538
-
.. vale on
539
-
540
524
Service definitions
541
525
===================
542
526
543
527
Key each service with a unique name to all of Mautic, including other Plugins.
544
528
545
-
.. vale off
546
-
547
529
.. list-table::
548
530
:header-rows: 1
549
531
:widths: 25 17 15 50
@@ -621,8 +603,6 @@ Key each service with a unique name to all of Mautic, including other Plugins.
621
603
- boolean
622
604
- Define the service with lazy loading. Symfony ignores this until Mautic addresses https://forum.mautic.org/t/supporty-symfony-lazy-services/21923.
623
605
624
-
.. vale on
625
-
626
606
Mautic service tags
627
607
-------------------
628
608
@@ -707,7 +687,6 @@ Use ``categories`` to define Category types available to the Category manager. S
707
687
708
688
// ...
709
689
710
-
711
690
Parameters config items
712
691
***********************
713
692
@@ -726,21 +705,17 @@ Configure parameters that are consumable through Mautic's ``CoreParameterHelper`
726
705
727
706
// ...
728
707
729
-
730
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``.
731
709
732
710
.. note:: Parameters aren't exposed to the UI by default. See :ref:`components/config:Configuration` for more information.
733
711
734
-
735
712
Custom config parameters
736
713
************************
737
714
738
715
You can define custom configuration parameters in your Plugin to support configurable features, such as enabling or disabling functions.
739
716
740
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.
741
718
742
-
.. vale off
743
-
744
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.
745
720
746
721
To add these configuration options in Mautic's configuration section, you’ll need:
@@ -749,19 +724,13 @@ To add these configuration options in Mautic's configuration section, you’ll n
749
724
- A :doc:`Form type </components/forms>` that defines the fields.
750
725
- A specific view for rendering the form.
751
726
752
-
.. vale on
753
-
754
727
.. note::
755
728
756
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.
757
730
758
-
.. vale off
759
-
760
731
Config event subscriber
761
732
=======================
762
733
763
-
.. vale on
764
-
765
734
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``.
766
735
767
736
The following code example shows how a Plugin structures its event subscriber.
@@ -843,7 +812,6 @@ To register Plugin’s configuration details during the ``ConfigEvents::CONFIG_O
843
812
- The view that formats the configuration form elements, for example, ``HelloWorldBundle:FormTheme\Config``.
844
813
* - ``parameters``
845
814
- An array of custom configuration elements. ``Use $event->getParametersFromConfig('HelloWorldBundle')`` to retrieve them from the plugin’s configuration file.
846
-
.. vale off
847
815
848
816
Modify configuration before saving
849
817
----------------------------------
@@ -855,7 +823,6 @@ Register the event subscriber
855
823
856
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