When starting looking at getting Advanced Poll and date_popup working together this came up. I seems like it could be usefull to specify the subelements #title attribute, something like this:

  if (module_exists('date_popup')) {
    $form['settings']['start_date']['#type'] = 'date_popup';
    // Specify the label of the new date field 
    $form['settings']['start_date']['#date_date_label'] =  $form['settings']['start_date']['#title'];
    unset($form['settings']['start_date']['#title']);
  }

I choosed to call them #date_date_label and #date_time_label since a thought it was more descreptive then e.g #date_date_title (but that works as well).

CommentFileSizeAuthor
date_popup_label.patch1.52 KBanders.fajerson

Comments

karens’s picture

Status: Needs review » Fixed

Actually, in the rest of the code I'm doing all the labeling in themes, I just missed the labels in this module. In Drupal 6, all those themes become little .tpl files that will be easy for admins to alter while putting this in the $form array is something only developers can do much with.

I just committed a fix to add the themes to Date Popup and also added an option to show or not show the titles.

anders.fajerson’s picture

Category: feature » support
Status: Fixed » Active

So, for module developers, what is the best option to alter those labels?

karens’s picture

I ended up removing those labels, accidentally, since I was actually trying to accomplish something else. What I did with the date_select element was to add an option '#date_label_position' where you can indicate that labels should be above, within, or hidden (where 'within' means add something like --Year as the first item in the select list so you can see what is expected without taking up space with a title). I was going to do the same here, but realized I can't substitute a value like that into this field or the javascript won't work, so I stopped there and ended up with no labels.

I want the text of the label to be themeable, so if added back it needs to be theme('date_part_label_date', $element) or theme('date_part_label_time', $element). That will get it into the hands of themers, but I don't know how I can then make it available to developers.

Any ideas on how to do this and still make it possible for themers to adapt it?

karens’s picture

Status: Active » Closed (won't fix)

I don't think this still applies to the latest versions. Closing this old issue. Please create a new one if it does.