lzb-pro.componentRichText.textualControlTypes
Filters which control types the <RichText /> component may edit in place. A control type of your own that stores a plain string is not on the default list, so the component refuses to make it editable until its type is added here.
Attributes
| Name | Type | Description |
|---|---|---|
types | Array | control types the component may take over |
This filter takes one argument. There is no context object, so a handler cannot tell which block or which control the check is being made for.
The default list is text, textarea, rich_text, classic_editor, code_editor, url and email. It reaches the editor through window.lzbProRichText.textualControlTypes, which the plugin prints after running the PHP filter lzb_pro/rich_text/textual_control_types. Image, Gallery and Repeater are left off on purpose. All three register as string because they store JSON, and letting the component overwrite that with plain text would destroy the value.
Usage
wp.hooks.addFilter(
"lzb-pro.componentRichText.textualControlTypes",
"my.custom.namespace",
function (types) {
return [...types, "my_plain_text_control"];
},
);The check is (Array.isArray(types) ? types : []).indexOf(type) > -1, so a return value that is not an array is swallowed and makes every type non textual. Every <RichText /> then renders as a static fallback with a console warning, and the block builder turns its Rich Text notice from info into an error. This filter moves the editor half only. The front end render reads the PHP list, so change lzb_pro/rich_text/textual_control_types when both halves must agree, and use this one only for an editor-side adjustment on top of it. Rich Text component covers what the component does with a value once it is editable.