lzb.constructor.control.settings
Fills the control-specific slot in the block builder's settings panel, the gap between the Type row and the Default row where a control type puts the settings only it has. Every Pro control that carries its own options registers here, lzb.constructor.control.units.settings for the unit list, lzb.constructor.control.message.settings for the message text.
Attributes
| Name | Type | Description |
|---|---|---|
render | JSX | String | what the type-specific filter returned, '' when none ran |
props | Object | data, id, updateData, controlTypeData |
| Name | Type | Description |
|---|---|---|
data | Object | the selected control's settings: type, name, label, default and any of its own |
id | String | key of this control inside the block's controls object |
updateData | Function | merges settings into the control, updateData({ units: "px,em" }) |
controlTypeData | Object | the registered control type: name, icon, type, label, category, restrictions, attributes |
Additional Filters
| Name | Description |
|---|---|
lzb.constructor.control.CONTROL_TYPE.settings | one control type only, and it runs before the generic filter |
The type-specific filter is applied first with '' as its starting value, then this one runs on whatever came back. So a handler on the generic name sees the type-specific markup and can add to it or drop it.
Usage
wp.hooks.addFilter(
"lzb.constructor.control.my_json.settings",
"my.custom.namespace",
function (render, props) {
const { TextareaControl, PanelBody } = wp.components;
return (
<PanelBody>
{render}
<TextareaControl
label="Schema"
help="JSON schema the control validates against."
value={props.data.my_json_schema || ""}
onChange={(value) => props.updateData({ my_json_schema: value })}
/>
</PanelBody>
);
},
);Settings written with updateData are saved on the control record, so the same key is readable from PHP and from the editor filters. Adding or removing whole rows is a different job. lzb.constructor.control.settings-rows takes the map of row components and lets you insert your own row or delete a built-in one, while this filter only fills the one slot the plugin has reserved for control types.