Jump to content

Parent Field


Joss
 Share

Recommended Posts

I am sure this has been talked about before - but never mind, here goes!

A configurable single select drop down field where you can chose the parent of a new page.

This is aimed at two uses - the Add New button and Lister.

So, you have this structure in pages:

Home

--- News

--- --- Cat 1

--- --- --- Post 1

--- --- --- Post 2

--- --- Cat 2

--- --- --- Post 3

--- --- --- Post 4

--- --- Cat 3

--- --- --- Post 5

--- --- --- Post 6

Post all have the same Template

Cat all have the same Template

In template settings for Post, you would be able to say that it could have three parents - Cat 1, Cat 2, Cat 3

So, this would not be allowed template for parents, but allowed parent pages.

A check box might say "Add this as a field option"

If that it true and the add to add new button is true, when the Add New button is clicked, the resulting new page form has two fields - Title and a Parent select.

Within Lister, a similar thing becomes possible where you can select more than one parent page.

This only has certain uses, but it does encourage the use of the page hierarchy which is good for sitemaps.

Getting Clever - or too clever!

However, it might need to get a bit more clever. So, for instance, you might be able to select:

"Automatically add new options based on template."

This means, that as more categories are added to the above scenario, then the parent list automatically updates.

Perhaps you can do both options at the same time:

  • Select specific templates for potential parents
  • Select specific pages for potential parents

The difference is that if you have templates called Blue Categories, Red Categories, Basic Page, and you want all pages in Blue and Red to be parents, but only 1 specific page from the basic-page template to be a parent, that can be set up.

Getting way over clever

There is a further mad enhancement using dependencies. Let us say that you have several levels of categories starting with three main categories, Red, Blue, Green

You select on of those as a parent to create the page, but once you have, you then have a required (optional) Parent Field in your template which chooses a sub-category based on the initial selection. Once that is chosen, if there are sub-sub categories, then a new field appears with these. And so on. 

You can drill down your complicated catalogue, if that is a good way to do it for your site, and retain the page hierarchy.

You could also do this as a single drop down on the page create dialogue where the dropdown shows the hierachy as a list, with parents also displayed so you can see the relationships:

Blue

Blue > Shoes

Blue > Shoes > Women's

Multiple Categories

This only works with single categories since a page can only have a single parent, obviously. However, there is no reason why you could not add a normal page field to add cross relationships, though I suppose it would be nice for this to exclude the parent page from the list - might be a bit too, too clever that one!

Link to comment
Share on other sites

Okay, Mr Knight. I haven't done a graphical mockup, but I have worked it through in a more logical way:

Allowing the selection of a parent for a field on creation of a child page.

The system is allied to the Add New tab and allows the user to choose the parent of the new page within the hierarchy defined by a predetermined list.

Template Family Tab

One or more parent pages can be selected on a template being used for children.

Allowed Parents

Three choices:

  • ASM Select - choose specific pages
  • ASM Select - Choose pages who's templates are - select one or more templates
  • Field - any other select criteria for parents using normal select syntax.

If any one or more of these are used, then when you create a page of a specific type from the Add New button, the drop down is shown on the initial create form, but the value can be edited in the Settings tab.

Only one parent can be chosen in this default state. However, if parents are being used as categories and the post needs to be associated to more categories, then this can be treated as the primary category and the others can be added, perhaps, using a page field as normal.

Settings

Under settings there would be a new area where the dropdown is repeated. This allows the choice of parent to be changed. However, this action would actually move the page in the Pages Hierarchy. Are there any checks that should be made that might prevent this from happening?

Lister Configuration

I originally suggested this should also be part of the lister configuration for the lister Add New button, but this is a bad idea since depending what the list is, the pages might be from more than one template.

However, if you do Add New on a lister, and the template of the new page has the above setting, then that would override the Parent setting on the lister configuration.

Multiple Templates

More than one template can share parents with this system. You may have several templates with access to the exact same set of parents, or with overlapping selections and so on. There is no reason to limit this.

However, if a parent has set templates that can be used for children, then that parent-template combination cannot be chosen by other templates.

Limitations

There is a problem if a child page is created in such a way as you have a choice of templates. There is two ways around this:

  • Like the current add new system, limitations are attached to make the system work. So, the templates of all potential parents must have only one template possibility for child pages, and it must be the same page.
  • The create page dialogue comes up as at present. When the template is chosen, a check is made and if the chosen template is to be used in this way, a new field is opened with ajax with the choice of parents. Selecting one would be required.

I think the second is a better choice simply to cover combinations of familial relationships which are not predictable and to allow more than one template to be used for the child.

For instance, if this is a news service, then you may have different templates for reviews, recipes, politics, and so on.

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