How to lock similar fields in modules via template

Hey there,

it is possible to lock whole modules over a template by using overridable=False. But can you also lock only some fields of a module used in an template? Maybe with the module_attribute tag?
Thank you

Hi @Torsten_Utz,

I don’t think you can lock down the entire module but you can lock down individual fields inside of a module.

In order to do this, you can add “locked”: true to the fields.json of your module.

Sample json for a rich text field:

[
 {
 "default": "<h1>Hello World</h1>",
 "display_width": null,
 "id": "text",
 "label": "Intro Text",
 "locked": true,
 "name": "intro_text",
 "required": false,
 "type": "richtext"
 }
]

The “locked”: true will prevent this field from being changed when editing a page. You would need to add this for every field in fields.json file of your module.

Hope this helps!

thank you for your answer. But this was not the question. I do not mean the developing of a module. I would lock fields when I am using the module for example:

{% module_block module "module_17369444912602" path="/lichtline-theme/modules/ll-image-header", label="ll-image-header", overrideable=False,... {% module_attribute "subline_text" %} ... {% end_module_attribute %} {% end_module_block %}

Thank you for clarifying. While, yes, the overrideable=False can prevent the entire module from being edited on a page, there isn’t an equivalent for individual fields.

You would either need to edit the fields.json as I mentioned or you can also use this setting in teh design manager when editing a specific field in the module.

Thank you for the answer. This should be a new feature, cause so its not easy using modules for dynamic pages an giving the style control to the content editor.