CMS Development

Torsten_Utz
Contributor

How to lock similar fields in modules via template

SOLVE

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

0 Upvotes
1 Accepted solution
evaldas
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

How to lock similar fields in modules via template

SOLVE

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.

 

 

evaldas_0-1740671497300.png

 

 


✔️ Did this post help answer your query? Help the community by marking it as a solution.

View solution in original post

4 Replies 4
evaldas
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

How to lock similar fields in modules via template

SOLVE

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!


✔️ Did this post help answer your query? Help the community by marking it as a solution.

Torsten_Utz
Contributor

How to lock similar fields in modules via template

SOLVE

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 %}




0 Upvotes
evaldas
Solution
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

How to lock similar fields in modules via template

SOLVE

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.

 

 

evaldas_0-1740671497300.png

 

 


✔️ Did this post help answer your query? Help the community by marking it as a solution.

Torsten_Utz
Contributor

How to lock similar fields in modules via template

SOLVE

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.