I have several forms that requires different names for start and end dates. Current date field uses the same label for both: Date.

How can I change it via date_combo_process_alter? I'm not sure how to alter the label when using the popup calendar widget. The code below does not works, only the portion to remove the inline "to".

function mycustomwebform_date_combo_process_alter(&$element, &$form_state, &$context) {
    if ($element['#field_name'] == 'field_my_custom_dates') {
        $element['value']['#date_title'] = 'From';
        $element['value2']['#date_title'] = 'To';
        $element['value2']['#title'] = t('');
    }
}

Comments

luthien’s picture

Issue summary: View changes
dgroene’s picture

No variable you change is going to alter the label because the word 'Date' is hard-coded in the theme function:

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

To change the label, you need to override theme_date_part_label_dates.