Skip to content

Commit 544f8d9

Browse files
authored
Rules : add example of separateur/section for getActions() & getCriterias() (#205)
* Rules : add example of separateur/section for getActions & getCriterias() * apply suggestions & clarify the key value
1 parent abbb20a commit 544f8d9

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎source/devapi/rules.rst‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,31 @@ You need to add the following classes for describing you new ``sub_type``.
149149
}
150150
}
151151
152+
A separator can be added in the criteria or actions lists by adding an entry with text contents.
153+
It render the following criteria/actions in an HTML fieldset with the provided text as legend.
154+
155+
.. code-block:: php
156+
157+
<?php
158+
159+
class RuleMytype extends Rule {
160+
161+
function getCriterias() {
162+
return [
163+
'_users_id_requester' => [...],
164+
'separator' => __('Additional criteria'), // can be any string, not only 'separator'
165+
'_users_id_observer' => [...],
166+
];
167+
}
168+
169+
function getActions() {
170+
return [
171+
'separator' => __('Observers'),
172+
'_users_id_observer' => [...],
173+
];
174+
}
175+
176+
152177
* ``src/RuleMytypeCollection.php``
153178

154179
.. code-block:: php

0 commit comments

Comments
 (0)