Support forums : You can sense the bug

Widget Title from a plugin might not work

Not like "it smells funny when I click that". This is for bugs that don't show an error but something just doesn't seem right or ends up doing something you think is wrong. It doesn't show you an error but you know something ain't right.

Moderator: Dracones

Widget Title from a plugin might not work

Postby EdB » Fri Jul 15, 2011 11:10 pm

Kinda maybe might be my plugin, but core is aiding and abetting a problem so here it goes.

Rebuilding my random youtubes plugin. Figured I'd do a test installation to make sure it works. Fixed a whole bunch of crap, then finally it all installed and worked fine except for one or two things. On the widget settings page we always get a field for the widget name in the admin side and the title on the public side. So I put "name field" and "title field" just to see where they went. I personally think the "name field" is displayed like crap BUT the "title field" never showed up in public.

The plugin/widget is made to put the title of the video as the "title" of the widget, so how come we even have a field for "title" if the widget doesn't specifically allow it to be set via a setting?
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: Widget Title from a plugin might not work

Postby leeturner » Sat Jul 16, 2011 5:55 pm

Is this supposed to be an automatic thing? I think I might have done something like the following in one of my plugins:


Code: Select all
if(  $params['block_display_title'] && !empty($params['widget_title']) )
{
   echo $params['block_title_start'];
   echo $params['widget_title'];
   echo $params['block_title_end'];
}


L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: Widget Title from a plugin might not work

Postby EdB » Sat Jul 16, 2011 6:14 pm

What I'm saying is kinda complicated. My randomyoutubes plugin (which is just about to be revitalized) simply does not use the widget_title param. The core, kinda of course, assumes that there will be a widget title, which there is, but it happens to be the title of the randomly selected youtube video. In the admin side however things are different: it says the title provided will be used on the blog. That statement is assumed to be true but obviously doesn't have to be.

I'm thinking that part of the solution is to make it only show that field IF the widget-producing plugin asks for it. The "name" field is for the admin side when looking at what widgets you have so it makes sense for all widgets to always ask for that. The $wi_class$ and $wi_id$ fields (might be %s instead of $s ... dunno off the top of my head) are always options that a template might take advantage of, but the title for public display probably ought to be like all other widget settings: only available if the plugin code allows for a title.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: Widget Title from a plugin might not work

Postby leeturner » Sat Jul 16, 2011 6:20 pm

Ah, I see what you are saying now. Good point. Sounds like a good idea to me.

Just out of interest, does your random YT plugin allow me to not have the title at all if I choose ?

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: Widget Title from a plugin might not work

Postby EdB » Sat Jul 16, 2011 6:40 pm

leeturner wrote:... Just out of interest, does your random YT plugin allow me to not have the title at all if I choose ...

Nope. Good idea though, and rather easily added. I'm thinking right now of a global "use/don't use" instead of a case-by-case basis. I did just now add in the idea of old vids versus new vids due to youtube changing their stock expected width. And since a third of the vids that were default when I made it for that other app are now taken down for various reasons I changed them to 1 old width and 2 new width versions of The Logical Song :)
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona

Re: Widget Title from a plugin might not work

Postby leeturner » Sat Jul 16, 2011 7:50 pm

Cool :D

Will have to check it out when it is finished. Sorry for all the questions but are the YT vids random from a user configurable list ?

L
leeturner
Dracone
User avatar
 
Posts: 730
Joined: Fri Dec 11, 2009 11:55 am
Location: Brighton, UK

Re: Widget Title from a plugin might not work

Postby EdB » Sat Jul 16, 2011 8:24 pm

Yes, and the plugin settings allow for a per-widget-instance option. Either plugin or widget, you put "code::title" into one of two html textarea field (kinda like how smilies are done), and it then picks one from a combined list and makes it be the width you specify in your settings. The 2 boxes are for old and new widths, which I assume to be 425 and 560. They scale down really nicely too by the way.

Hey one day when we have a bunch of videos about QP we can put them all up on youtube then on our various blogs we can put a randomly selected training video. hmmm... now I'm thinking I need some way to be able to link the video's title (if used) back to an entry in the blog. Maybe "code::title::link" and "if link is present then link title to link assuming title displayed is checked" would allow for linking the title to either a post or a category appropriate for that particular video.

hmmm... methinks that'll be v2 material cuz I really gotta finish rewiring my shiny old pickemup truck.
EdB
Dracone
User avatar
 
Posts: 2072
Joined: Sun Nov 22, 2009 7:20 am
Location: Maricopa Arizona


Return to You can sense the bug

Who is online

Users browsing this forum: No registered users and 1 guest

cron