@@ -104,6 +104,7 @@ You need to add the following classes for describing you new ``sub_type``.
104104 }
105105
106106 // return an array of criteria
107+ // default type can be found under Rule::getCriteriaDisplayPattern
107108 function getCriterias() {
108109 $criterias = [
109110 '_users_id_requester' => [
@@ -128,15 +129,6 @@ You need to add the following classes for describing you new ``sub_type``.
128129
129130 ];
130131
131- $criterias['GROUPS']['table'] = 'glpi_groups';
132- $criterias['GROUPS']['field'] = 'completename';
133- $criterias['GROUPS']['name'] = sprintf(__('%1$s: %2$s'), __('User'),
134- __('Group'));
135- $criterias['GROUPS']['linkfield'] = '';
136- $criterias['GROUPS']['type'] = 'dropdown';
137- $criterias['GROUPS']['virtual'] = true;
138- $criterias['GROUPS']['id'] = 'groups';
139-
140132 return $criterias;
141133 }
142134
@@ -291,6 +283,41 @@ To call your rules collection and alter the data:
291283 $params
292284 );
293285
286+ Test for rule collection
287+ ^^^^^^^^^^^^^^^^^^^^^^^^
288+ .. versionchanged :: 11.0.5 plugin and core RuleCollection can change the test path by overriding the ``RuleCollection::getRulesTestURL`` function.
289+
290+ For plugins, there is currently no GenericController so you must implement it.
291+
292+ Here is the minimal setup:
293+
294+ .. code-block :: php
295+
296+ <?php
297+
298+ namespace GlpiPlugin\MyPlugin\Controller;
299+
300+ use Glpi\Controller\AbstractController;
301+ use Symfony\Component\HttpFoundation\Request;
302+ use Symfony\Component\HttpFoundation\Response;
303+ use Symfony\Component\Routing\Attribute\Route;
304+
305+ final class RuleTestController extends AbstractController
306+ {
307+ #[Route(
308+ "/rules/test", // /front/rulesengine.test.php for version previous to 11.0.5
309+ name: "rule_myplugin_test",
310+ methods: ["GET"],
311+ )]
312+ public function __invoke(Request $request): Response
313+ {
314+ // No generic RuleTestController controller for now
315+ include(GLPI_ROOT . "/front/rulesengine.test.php");
316+ return new Response();
317+ }
318+ }
319+
320+
294321 Dictionaries
295322^^^^^^^^^^^^
296323
0 commit comments