Skip to content

Commit 1ced492

Browse files
committed
docs: refine simple_metric_config documentation
1 parent 33ca83f commit 1ced492

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,12 @@ class blocks_used_config extends simple_metric_config {
315315
That's it.
316316
There is no need to override any of the `metric_config` methods by hand.
317317

318-
> [!IMPORTANT]
319-
> The [constructor property promotion][php docs constructor promotion] is _required_ here! Same as making the config parameters **public**.
320-
321318
This data class is meant to represent both the JSON "schema" for (de-)serializing the actual metric config from/to the database and the shape of the initial/submitted form data.
322319

320+
> [!IMPORTANT]
321+
> Using [constructor property promotion][php docs constructor promotion] and declaring those properties `public` is done very deliberately!
322+
> The class allows ways to achieve the same results with a different setup, but this is the most concise way.
323+
323324
Under the hood, the `simple_metric_config` class will also automatically define the config form fields appropriately.
324325
This means it will do the following for each public property in the constructor:
325326

@@ -330,7 +331,7 @@ This means it will do the following for each public property in the constructor:
330331
5. Add a validation rule for that input (optionally).
331332

332333
So our example config form will have a text input field named `minblockagehours` and a checkbox for `includehidden`.
333-
Also, the type for the former will be `PARAM_FLOAT` and its value will be immediately validated to be numeric on the client side.
334+
The type for the former will be set to `PARAM_FLOAT` and its value will be immediately validated to be numeric on the client side.
334335

335336
> [!NOTE]
336337
> The order of the constructor parameters determines the order of the form fields.

0 commit comments

Comments
 (0)