Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-06-09 17:03:54
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
[request] "Cascading" custom fields.
Just want to test the water with this idea, if there are enough bites I might go with it.
You folks know I like TXP and I like writing plugins for TXP but I sometimes wish there was more at the section level. For example, it would be neat to be able to control my comment settings at the per-section level instead of globally.
I did something like this for the comments set-up on a per-article basis using packed custom fields (released here). As I was doing that, I realised it should be possible to extend my PCF plugin to allow empty custom fields to default to values stashed at the section level. In effect giving you cascading custom fields where the per-article value overrides the per-section value.
For example:
Currently: You use field1 if it is present and field2 as a default in case field1 isn’t set. (2 fields used out of your allocation of 10 per article)
Proposal: Use field1 if it is present in the article. If not, use field1 from the section instead. (Only uses 1 field at the article level)
Did I mess up my thinking?
Would this be useful to anyone?
Bites?
Last edited by net-carver (2006-06-09 17:41:05)
— Steve
Offline
Re: [request] "Cascading" custom fields.
Right on.
Not sure if I understand correctly, but, here’s my frustration with custom fields.
eg. a products section should have product specific custom fields, and reviews section should have custom fields specific to it’s section. Currently, all articles display all fields on the write page. This makes it a bit clunky for someone to see price-related information when they’re adding review-related information. Especially if you divide up roles to different people in editing a site.
Just quick thoughts. Not sure whether they fit, but your ideas sounds good.
Offline
Re: [request] "Cascading" custom fields.
mrdale wrote:
Not sure if I understand correctly, but, here’s my frustration with custom fields.
eg. a products section should have product specific custom fields, and reviews section should have custom fields specific to it’s section. Currently, all articles display all fields on the write page. This makes it a bit clunky for someone to see price-related information when they’re adding review-related information. Especially if you divide up roles to different people in editing a site.
I actually have a plugin running around in my head to allow for this, as it’s a big pet peeve of mine as well. I just need to get my head above water from all the work i backlogged while my arm was broken to code it.
Shoving is the answer – pusher robot
Offline
Re: [request] "Cascading" custom fields.
I’ll third that mrdale!
I’ve cobbled together a shop addon as a series of forms but it only applies to one section of the site. It confuses the heck out of my business partner (bless him) when he wants to write an article and sees Product Code, Product Options, Price, Location etc in the custom fields down the side. It seems the more boxes there are, the more he runs away from TXP.
It’s not a massive issue for me but I guess for him, not being the slightest bit code-savvy (he uses Frontpage for his own site… sheesh!), to bombard him with more custom tags than he needs is information overload.
So to only show fields from sections that apply would be awesome. I’ll test any and all plugins that sprout forth.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#5 2006-06-10 02:50:15
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: [request] "Cascading" custom fields.
I like what you have come up with so far and it sounds like hakjoon’s got some ideas to handle per-section specific fields in the article write tab.
I had not thought about changing the custom field name-set and display of custom fields on the write tab based on the parent section—but perhaps it is going to be more useful (and more complicated!) Let me re-focus on my initial idea for a while and see if it makes more sense this time round :O) We can come back to the above if this bit’s a flop.
I was thinking of making PCF an admin-side plugin that…
- adds a tab under extensions where you can set the contents (not names) of custom fields at the section and global level.
- gives you replacements for the default custom_field tags. These replacements would look for the value in the per-article field and if it’s missing, go to that article’s per-section custom field. If that’s missing, go to the global custom field to grab the value.
- allows any of these fields to be packed and picked apart by the new tags too.
In effect it’s like ‘cascade’ in CSS as the global values get overridden by the section values, which get overridden by the article values.
— Steve
Offline
Re: [request] "Cascading" custom fields.
I think the cascade idea is great and could become specially powerful in 4.1 with sub-sections.
Shoving is the answer – pusher robot
Offline
#7 2006-06-24 01:54:30
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: [request] "Cascading" custom fields.
Thanks hakjoon,
looks like some others are wanting the ability to customise the custom field labels on a per-section basis.
Any news on your idea to do this?
I think this would be possible using JS to change the DOM after the page has been loaded but it will be a little difficult for newly created articles that have yet to be assigned to a section. I also wonder if Inspired is touching on this area with the show/hide admin fields request from Matthew.
— Steve
Offline
Re: [request] "Cascading" custom fields.
I figure the only way to really do it is using the DOM. There is a default section specified so I figure that would be the baseline for which fields to show when you first go into the write tab and as you change the section the custom fields would change. I figured I would include an option to show the customized fields by default (which makes the most sense to me) or to hide them behind advanced options like it is now.
I’m still fleshing it out, but unfortunately work and life have been keeping me busy. I’m hoping to finish my update to the tinyCME plugin shortly (new version broke a bunch of stuff) and then start working on this.
Shoving is the answer – pusher robot
Offline
#9 2006-06-25 11:47:00
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: [request] "Cascading" custom fields.
hakjoon wrote:
I figure the only way to really do it is using the DOM. There is a default section specified so I figure that would be the baseline for which fields to show when you first go into the write tab and as you change the section the custom fields would change.
That sounds like a good way to approach it.
I figured I would include an option to show the customized fields by default (which makes the most sense to me) or to hide them behind advanced options like it is now.
It might be worth talking to Yura (aka Inspired) to see what he is up to in this area just so your plugins can co-exist nicely. You can trace his conversation in the plugin request thread I posted before.
As you know, I am toying with the idea of adding a cascade to the custom fields via my PCF plugin’s tags. I’d also like our two plugins to play nicely together too. As you are interested in the naming problem I’ll stay well away from it and make sure PCF only plays with content of fields.
— Steve
Offline
Re: [request] "Cascading" custom fields.
I’ve hacked together something that solves this problem, in a similar vein — I have different Write tabs for different article types.
I’ve written one admin plugin that divides the Write tab into discrete chunks (body, categories, custom1, custom2, etc) and then other admin plugins that ‘describe’ an article we’re writing, producing faux section-level article types. if you want to edit Reviews you go to Content>Reviews and everything is laid out and labelled only w/ the info you wanted.
There’s been a fair bit of core modding (mostly to the admin interface) but once this is sharable I’ll be sure to put some code out there
Offline
#11 2006-06-25 15:12:04
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: [request] "Cascading" custom fields.
Jamie,
that sounds like a really neat idea :O)
— Steve
Offline
Re: [request] "Cascading" custom fields.
The long term plan for what I wanted to do was to try to implement something like MODX’s template variables (although not quite as powerful), but basically you would be able to control not only the name of Custom fields but also what field type it is so you could setup drop downs or checkboxes stuff like that.
Shoving is the answer – pusher robot
Offline