Feature request: presets for custom fields

Creating and modifying plugins.
Post Reply
User avatar
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Feature request: presets for custom fields

Post by yellowled » Sat Oct 27, 2012 3:52 pm

The entryproperties plugin offers the option to add custom fields for entries. Sometimes, it would be useful to be able to add “presets” to those fields.

For example, I use custom fields in the S9y InfoCamp blog to add urls to and sizes of the mp3 and ogg files to entries. The actual values for the url fields are very much alike, only the number of the episode changes.

Suggested syntax: key:value, i.e. “Customfield1:Presetvalue1,Customfield2:Presetvalue2” etc. Or just use “Customfield1,Customfield2” to not use presets.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

Re: Feature request: presets for custom fields

Post by Don Chambers » Sat Oct 27, 2012 4:25 pm

Excellent suggestion.

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

Re: Feature request: presets for custom fields

Post by garvinhicking » Mon Oct 29, 2012 1:25 pm

Hi!

Good idea. Shouldn't be too hard to implement.

Regards,
Garvin
# 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
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Feature request: presets for custom fields

Post by yellowled » Mon Oct 29, 2012 4:32 pm

Should be possible to “mix” key:value pairs as well, i.e. “Customfield1,Customfield2:Presetvalue2”.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

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

Re: Feature request: presets for custom fields

Post by garvinhicking » Tue Oct 30, 2012 11:48 am

Hi!

Just committed to the 1.7 branch. Please test if this works for you, then I'll commit to 2.0 tree as well.

New variable also allows to escape ":" and "," if you need to use it for the default value; thought that might be important.

Regards,
Garvin
# 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
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Feature request: presets for custom fields

Post by yellowled » Wed Oct 31, 2012 10:33 pm

Works just fine for me, including the escape mechanism.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Feature request: presets for custom fields

Post by yellowled » Thu Nov 29, 2012 12:37 pm

Hmmmm. In 1.7-alpha1, I get this when publishing an entry:

Code: Select all

== TESTING ERROR MODE ==

Array
(
    [0] => 2
    [1] => explode() expects parameter 2 to be string, array given
    [2] => /var/www/virtual/xxx/sub.domain.tld/plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php
    [3] => 179
    [4] => Array
Full error log: https://dl.dropbox.com/u/691134/entryprop-error.txt

Might be due a strange setup in my dev blog, though.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Feature request: presets for custom fields

Post by Timbalu » Thu Nov 29, 2012 1:16 pm

Could you please check if you have this last commit change in it?
https://github.com/s9y/Serendipity/comm ... erties.php
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Feature request: presets for custom fields

Post by yellowled » Thu Nov 29, 2012 2:53 pm

Probably not, I haven't updated this dev blog in a while since I've been working on 2.0. My bad. I will report back if updating does not fix it.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
yellowled
Regular
Posts: 7083
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Feature request: presets for custom fields

Post by yellowled » Thu Nov 29, 2012 3:04 pm

yellowled wrote:Probably not, I haven't updated this dev blog in a while since I've been working on 2.0. My bad. I will report back if updating does not fix it.

EDIT: JFTR, it works fine in latest 1.7.

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Post Reply