array "title" vs. "name"

Discussion corner for Developers of Serendipity.
Post Reply
User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

array "title" vs. "name"

Post by Don Chambers » Wed Mar 11, 2015 1:03 am

After going through a bunch of themes, I find a number of theme configs define their options much like this:

Code: Select all

    array(
        'var'           => 'navlink1text',
        'title'         => 'Navlink #1 Text',
        'description'   => 'Enter the first navigation text',
        'type'          => 'string',
        'default'       => 'About',
    ),
Note 'title'. This does not display on the backend. 'description' does display, but it is only revealed by clicking on the little info button. 'name' (not shown above) is what I have always used in my themes, and it works where 'title' does not.

So, either 'title' has to be restored, or a lot of themes need to be modified. I believe restoring 'title' is the way to go because there could be a lot of custom themes that are not in github.

User avatar
onli
Regular
Posts: 2227
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: array "title" vs. "name"

Post by onli » Wed Mar 11, 2015 3:22 pm

When did that work last? If that broke in 1.2 for example, it does not seem to be necessary to restore it.

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: array "title" vs. "name"

Post by Don Chambers » Wed Mar 11, 2015 3:25 pm

I couldn't tell you when it broke, I only know we have many themes in additional_themes that use it.

User avatar
onli
Regular
Posts: 2227
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: array "title" vs. "name"

Post by onli » Wed Mar 11, 2015 3:58 pm

Maybe someone with an 1.7.8 test-installation could look into one of the old themes and test it? I'd immediately fix it if it worked in 1.7.8 and we broke it by accident in 2.0. But if it broke before, I would vote for keeping the hopefully smaller code - based on my expectation that those old themes are not used anymore anyway, and if they are and the title is not shown, that is not a really grave bug. We could then document how exactly the syntax has to look for 2.0

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: array "title" vs. "name"

Post by garvinhicking » Wed Mar 11, 2015 4:25 pm

Hi!

I checked; with 1.7.8 it was "title".

Ideally for 2.0 I propse to accept both "title" and "name" (use "name" if existing, fallback to "title"). This way all (now patched) config.inc.phps should work...?
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
onli
Regular
Posts: 2227
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: array "title" vs. "name"

Post by onli » Wed Mar 11, 2015 5:28 pm


User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: array "title" vs. "name"

Post by Don Chambers » Wed Mar 11, 2015 5:33 pm

I have checked with 1.7.8, 1.7.2, 1.6.2, and 1.5.5 - "title" doesn't work in any of them.... Yes, I really have a blog running 1.5.5, which I didn't realize until just now! :lol:

Because we have so many themes that use "title", I think it should work.... either that, or we should modify all those themes to use "name" instead.

I suspect there are probably custom themes out there using "title", but the only way they would know it no longer works is to change theme options... and how often does anyone really change their theme options once configured?

User avatar
onli
Regular
Posts: 2227
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: array "title" vs. "name"

Post by onli » Wed Mar 11, 2015 5:38 pm

Oi? One of you two has to be wrong!

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: array "title" vs. "name"

Post by Don Chambers » Wed Mar 11, 2015 5:45 pm

onli wrote:Oi? One of you two has to be wrong!
I tested using the 1024px theme. The first two configuration items are as follows:

Code: Select all

    array(
        'var'           => 'colorset',
        'description'   => 'Select colorset option',
        'type'          => 'select',
        'default'       => 'blue',
        'select_values' => array('default' => 'Blue', 'red' => 'Red')
    ),
    array(
        'var'           => 'contentposition',
        'title'         => 'Sidebar Position',
        'description'   => 'Sidebar left or right',
        'type'          => 'radio',
	  'radio'         => array('value' => array('true', 'false'),
					'desc' => array('Left', 'Right')),
        'default'       => 'true',
    ),
The first one 'colorset' doesn't have name or title, but the description is displayed. The second one uses title, which doesn't display, but again the description does.

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: array "title" vs. "name"

Post by garvinhicking » Thu Mar 12, 2015 11:02 am

Hi!

That is strange. I must admit I read the code, and not test it with an actual installation.

The code uses 'title' of the property bag... But if Don really tested it with an actual installation, I think we should believe him, and not my reading of the code ;-) Sorry for the noise.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
onli
Regular
Posts: 2227
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: array "title" vs. "name"

Post by onli » Sun Mar 15, 2015 12:28 am

Ok, then if that broken for such a long time, I would prefer not to re-introduce it. I will close the issue, let us just try to think about this when rewriting the documentation.

If any of the important themes (all new ones, bulletproof, maybe idea) are hit by that change, we should fix those. I'll take some minutes to see why this is broken though, maybe there is a bigger bug behind this.

Maybe my reaction here is wrong, then just someone else do this please. I just do not want to have two ways to do the same thing, that would confuse me.

User avatar
onli
Regular
Posts: 2227
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: array "title" vs. "name"

Post by onli » Sun Mar 15, 2015 12:43 am

It is name, because templates are using serendipity_plugin_config, where that has always been "name" I think.
Which really is confusing, because the syntax in the templates - how the configuration is defined - looks much more like an internal config template. That probably fooled you, garvin?

Maybe that would be something for the roadmap, to use only one way to print configs everywhere?

Post Reply