Jump to content

Troubleshooting 'Page Field Select Creator': find hidden template and assign it to new pages


kathep
 Share

Recommended Posts

Hey all

I have come across a glitch when trying to add a new page to a tree created with the Page Field Select Creator.

Steps taken

  1. The tree looks like this:
    post-2947-0-26890200-1421628955_thumb.pn
    The page called Online Tools has 'basic-page' template, and all existing child pages have 'online_tools' template.
     
  2. I click on the 'new' button to the right of Online Tools, then type in the new page name, like so:
    post-2947-0-83120800-1421628953_thumb.pn
     
  3. After I click 'save', I see that my new template has been assigned the template 'lesson_plan_section_type' (this is the only other template I have created with Page Field Select Creator). 

    post-2947-0-38127200-1421628952_thumb.pn

    'No problem,' I think 'I'll just head on over to the settings tab and change that sucker'

    But then...

Sad result

post-2947-0-22423100-1421628951_thumb.pn

*cue panic*
Where is my online_tools template?!
It is assigned to all existing pages, but currently cannot be assigned to my new page. 

I hoped I might be able to trick PW by creating a blank template called 'online_tools' and uploading it, but that didn't work :(

Is this a problem with Page Field Select Creator, or perhaps it is not designed to create new pages?

Does anyone know how to fix this?

*crossing my fingers it's an easy one*

Link to comment
Share on other sites

Hi there - I am having trouble following exactly, but Page Field Select Creator sets up the templates for the pages it creates with a setting the "Can this template be used for new pages?" set to "No". This is intentional because I like the trees of pages used for my page fields to have unique parent and child templates. The other settings that are automatically set are to limit the children of the parent page template to just those of the created children. This enables the "Allow new pages to be created from field?" setting to work.

I also don't usually allow more than one child template for a parent template as I think it can confuse site editors, but others may not agree here.

Sorry, I am answering this in a hurry, but if you change the "Can this template be used for new pages?" to Yes, I think it should solve what you are looking for, although I am not convinced I have got the issue exactly right, despite you detailed explanation :)

Just to clarify - you are using this module for create page fields, rather than general page trees? If you just want to create/edit page trees, check out Batch Child Editor.

Link to comment
Share on other sites

Hi @adrian, and thank you for developing such a great tool.
 

Hi there - I am having trouble following exactly, but Page Field Select Creator sets up the templates for the pages it creates with a setting the "Can this template be used for new pages?" set to "No". This is intentional because I like the trees of pages used for my page fields to have unique parent and child templates. The other settings that are automatically set are to limit the children of the parent page template to just those of the created children. This enables the "Allow new pages to be created from field?" setting to work.

 
I understand this. My problem is that I have created a template called online_tools for all child pages (using Page Field Select Creator), but cannot access it when creating a new page in the tree. I want to add new pages in order to add them to the associated pageselect field.

When adding a new child page below Online Tools, new pages are added by default with the wrong template - the template 'online_tools' is not shown, despite how Page Field Select Creator is supposed to work. Existing children have the correct template.

Sorry, I am answering this in a hurry, but if you change the "Can this template be used for new pages?" to Yes, I think it should solve what you are looking for, although I am not convinced I have got the issue exactly right, despite you detailed explanation :)

The option "Can this template be used for new pages?" for 'online_tools' is set to 'yes'. This is not related to my problem.
 

Hopefully this post helps you understand what I am asking.
 

Just to clarify - you are using this module for create page fields, rather than general page trees? If you just want to create/edit page trees, check out Batch Child Editor.

Yes, I understand. Don't worry, I am using it for the intended purpose.  ;)

Link to comment
Share on other sites

If the parent template settings are allowing pages with the parent template to have children with the child template and the child template settings are allowing creation of new pages under a parent page with the parent template, then it should all work fine. Sorry, that is a confusing sentence :)

Regardless, it shouldn't matter whether all these pages and templates with created manually or with Page Field Select Creator.

Any chance this site is live somewhere that I could log in and take a look for you? Otherwise, perhaps you could export the two templates for me so I can replicate things. You could do this via the built in Export functionality on the main templates page, or using Migrator (https://github.com/adrianbj/ProcessMigrator).

Link to comment
Share on other sites

RESOLVED

@Adrian, your reply prompted me to check the parent template. When I originally created the page tree in Page Field Select Creator, I typed 'basic-page' into the template field. 

What I did not expect is that instead of using the existing basic-page template, Page Field Select Creator created a duplicate basic-page template. I didn't eve know it was possible to have two, identically named templates. Anyway, it is. And the parent basic-page template Page Field Select Creator made had the wrong child template assigned to it (which occurred when I created another page tree using Page Field Select Creator, and selected basic-page as parent, and another template as child).

Have you ever had this issue of Page Field Select Creator duplicating existing templates? Perhaps it should be noted in the instructions.

Link to comment
Share on other sites

It shouldn't be possible - is one basic-page and the other basic_page ?

Generally it is safer (although not always necessary) to have dedicated templates for the page tree of a pagefield.

If the module is in fact creating duplicate templates, then that is something I need to fix for sure. 

Link to comment
Share on other sites

Behold the mystery...

post-2947-0-45079500-1421700217_thumb.pn

As you can see, I specified basic-page as the parent template, and a new template was created with a name of basic-page and a file name of basic_page. Weird. I had hoped it would recognize my order of 'basic-page' and assign that template to the parent. Now I know for next time.

Why is it 'safer' to assign a custom parent template? If you know of any references about this, please let me know. I'm keen to learn!

Link to comment
Share on other sites

The - vs _ is coming from the fact that the module makes use of $sanitizer->fieldName to convert the entered Label for the template into its name. fieldName doesn't allow dashes. 

I have committed a fix that should solve the mistake. Please let me know how it works for you now.

As for the custom templates - it is really situation dependent, but I like it so that I can restrict the creation of new child pages to just one template so the site editors never have to choose the appropriate template when creating a new child page option. 

  • Like 1
Link to comment
Share on other sites

@adrian Thanks for the update, and the explanation of custom templates for parents.

I suppose it has not seemed necessary to me as I've only been working on my own site so far. But definitely something to keep in mind once others are using my PW site.

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...