Minor change if someone could point in the right direction.

In Views all my other CCK fields exposed filters have in drop down But my Year seems to have "-Year" in it instead of

I would like to be able to change the label from "-Year" to "" to match all my other filters.

Tried using the stringoverrides to replace the -Year with but i assume this "-Year" is not being processed using t()

Any Ideas would be greatly appreciated!

Thanks

CommentFileSizeAuthor
#2 date_default_label.patch1.35 KBjulien
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

julien’s picture

Found a way to do it. You can edit date_api_elements.inc line 219 and add :
$element['year']['#options'][''] = 'your string';

Could be nice to have a variable_get instead of 'your string' to define it somewhere.

Hope that helps

julien’s picture

FileSize
1.35 KB

Here is a quick patch to fix this.

drupalfan79’s picture

@julien, how to do this in version 7.x-2.7

julien’s picture

Version: 7.x-2.x-dev » 6.x-2.7

Looking at this new version code, maybe you can try to use this theme function in template.php of your theme, see if it works. Haven't tested so i'm not too sure. Check if you can alter the element variable maybe.

/**
 * Returns HTML for a date select input form element.
 */
function theme_date_select_element($variables) {
  $element = $variables['element'];
  $parents = $element['#parents'];
  $part = array_pop($parents);
  return '<div class="date-' . $part . '">' . theme('select', $element) . '</div>';
}
jerrylow’s picture

Version: 6.x-2.7 » 7.x-2.x-dev

So I was looking into this myself for 7.x 2.x-dev and found this.

Look into module/date/date_api/theme/theme.inc and you'll find starting at line 104 the functions that generates the starting date label. Such as

function theme_date_part_label_year($variables) {
  return t('Year', array(), array('context' => 'datetime'));
}

So basically I copied that function into my template.php as so:

function templateName_date_part_label_year($variables) {
  return t('All', array(), array('context' => 'datetime'));
}

And it works great.

julien’s picture

Version: 6.x-2.7 » 7.x-2.x-dev

@jerrylow, thanks for that, indeed it's better using this than my solution.

DamienMcKenna’s picture

Issue summary: View changes
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.