I've been at this all day and can't nail it.
I want to remove the hyphen from in -Year, -Month etc. and capitalize the words.
I created a custom module but can't identify the correct variables in the: $form[] = t('')
Anyone done this before successfully...?
Thanks for any help.

<?php
/**
 * Change default labels on Date dropdown menus, e.g. -Year, -Month, -Day, etc.
 */
function date_label_changer_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'views_exposed_form' && $form['#id'] == 'views-exposed-form-worldmap-page-1') {
      $form['date_filter']['min']['year']['#label'] = t('YEAR'); 
  }
}

Comments

karens’s picture

Status: Active » Fixed

Don't remove the hypen, the code uses it to detect that this is not an actual value for the field. The text, other than the hypen, is controlled by individual themes like date_part_label_year(). See them in date/date_api/theme/theme.inc

cajmcmahon’s picture

Cool! Thank you.

Status: Fixed » Closed (fixed)

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