Parameter types¶
When adding a parameter to the block or a query in your block definition or a query type, you can specify the parameter name, the type of the parameter and parameter options. This is achieved through an object called parameter builder which is provided to you in your block definition or a query type.
Parameter builder has methods for working with the parameters: adding, removing and fetching the parameters as well as setting parameter options.
When adding parameters to block definitions or queries, referencing the parameter type is done by specifying FQCN of the parameter type.
Common parameter options¶
In addition to the list of options specific to each parameter type, all types
have four common options: required
, default_value
, group
and
label
.
required
¶
type: bool
, required: No, default value: false
Specifies if the parameter value is required or not.
default_value
¶
type: mixed
, required: No, default value: null
Specifies the default value of the parameter.
group
¶
type: array
of string
values, required: No, default value: array()
Specifies the parameter group. Groups are a generic concept when working with parameters. Netgen Layouts does not enforce or otherwise define how you use parameter groups. Internally, Netgen Layouts uses groups in block definitions to specify to which form (content or design) the parameter belongs and in query types to specify which parameters are advanced and hidden by default.
label
¶
type: string
, false
or null
, required: No, default value: null
Specifies the human readable name of the parameter. In Netgen Layouts this label is for example used in Symfony forms which edit blocks or queries.
Tip
Use false
to disable parameter label in Symfony forms. If null
is
specified, the label will be generated by using Symfony translation
component from the parameter name.
List of built in parameter types¶
The following lists all parameter types built into Netgen Layouts together with the options available in each parameter type.