medienbaecker / kirby-modules

Plugin for modular Kirby websites
MIT License
72 stars 7 forks source link

Prevent unauthorised modules from being moved #48

Open tan3ot opened 3 weeks ago

tan3ot commented 3 weeks ago

Thanks for the added feature which enables moving modules!

In some pages of my project there are only certain modules allowed which is realised by e.g. "create: module.text". Nevertheless, you can also move other modules into it.

Can you reproduce this behaviour?

medienbaecker commented 3 weeks ago

Wether moving is allowed depends on the pages sections of the destination page. All I did was adding a pages section with all of the module templates.

In other words: it doesn't matter what you do in the parent page.

tan3ot commented 3 weeks ago

Ok, so every module can be moved in every modules folder... Is it planned that the behaviour of the "move"-Function is like in normal pages – depending on what's allowed? If not – it's ok for it's not important – only nice-to-have...

medienbaecker commented 3 weeks ago

Yeah, unfortunately it's not so easy. The actual parent of the modules is the modules container while your settings are one level up. What happens if you have two modules sections in the parent page with different create settings? What about template and templatesIgnore?

For now I can't seem to find an easy solution.

tan3ot commented 3 weeks ago

Are two or more modules sections on one page possible? I did a test and it doesn't seem to work...

btw: templatesIgnore: modules is always important for pages sections in pages with Modules...

But yes: Obviously it's not trivial, as it also took longer for pages to implement this...

medienbaecker commented 3 weeks ago

It works if you set a different parent, so a separate modules container.

btw: templatesIgnore: modules is always important for pages sections in pages with Modules...

Absolutely. I normally define what kind of templates are allowed anyway to not have any bad surprises.