Jump to content

Limit creation of grandchildren


adrian
 Share

Recommended Posts

I am sure I am missing something (nothing new there :) ), but I have several very basic content pages which have one level of children. For these page I am using the basic-page template for the parent and the child. I want to make sure a user can't create grandchild, but I can't seem to figure out how.

I have other pages on the site that use templates like 'news' with the child having 'news-item'. It is easy in this case because I can allow creation of children for the news, but not for the news-item template.

Obviously I could change the 'basic-page' template to 'basic-page-parent' and then assign 'basic-page-child' to the children and set it up so that users can't create children on pages with the 'basic-page-child' template, but I feel like there should be an easier way. 

On the "What roles can access pages using this template (and those inheriting from it)?" page I'd expect to see an additional checkbox at the end:

 
ROLE    VIEW PAGES    EDIT PAGES    CREATE PAGES    ADD CHILDREN   ADD GRANDCHILDREN
 
Is there currently some other way to control this without assigning a different template to the first child level? It's not a big deal, but seems like a little bit of an unnecessary complication. If I do I guess I can assign basic-page.php to both the parent and child versions of the template in the "Alternate Template Filename" field.
 
Does that all make sense? :)
Link to comment
Share on other sites

You can enable advanced mode in config.php and then create a new template for childs. Under the fieldgroup list you see now a fieldgroup select from another template. Chose basic-page and youll have a reference. Set family settings how you need and unde advanced tab look for alternative template setting and enter basic-page. Now it uses same template file.

  • Like 4
Link to comment
Share on other sites

Hey Soma - thank you - I looked at the advanced mode a few weeks ago when I first started with PW but the extra options seemed overwhelming at the time.

Anyway, that worked a treat - but better than an extra, unneeded template php file as well as the ability to avoid needing to maintain changes to the fields for two separate templates.

Anyway, great answer - thanks again!

Link to comment
Share on other sites

ou can enable advanced mode in config.php and then create a new template for childs. Under the fieldgroup list you see now a fieldgroup select from another template. Chose basic-page and youll have a reference. Set family settings how you need and unde advanced tab look for alternative template setting and enter basic-page. Now it uses same template file.

I don't think that particular setting requires advanced mode? It is on the 'advanced' tab of the Template editor though. But that tab is unrelated to $config->advanced (despite the name).

Regarding advanced mode: I never use it, except when developing ProcessWire itself. I recommend people stay out of advanced mode unless temporarily needing to access some specific setting. The need for advanced mode never comes up in my own sites, at least. It can be dangerous to leave it on, just because some of the things you can "enable" (like 'system' status) are not easily reversible. 

Link to comment
Share on other sites

To select another fieldgroup for a template is only available in advanced mode.

That is true. I think it should be on advanced tab - it is something that can be very valuable on site building, not just for core/module development (which is where advanced mode is used).

  • Like 1
Link to comment
Share on other sites

That is true. I think it should be on advanced tab - it is something that can be very valuable on site building, not just for core/module development (which is where advanced mode is used).

I'm not 100% positive about the safety/stability of this option, which is why its only in advanced mode. It may very well be perfectly safe, but since it's something I never use myself, I didn't think I'd be using/testing it enough to adequately support it. It definitely creates a more abstract picture when it comes to the scope of deleting things, and that's the only area of concern I have with it. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...