function system_add_date_formats_form_validate

Validate new date format string submission.

1 string reference to 'system_add_date_formats_form_validate'
system_configure_date_formats_form in modules/system/system.admin.inc
Allow users to add additional date formats.

File

modules/system/system.admin.inc, line 2969

Code

function system_add_date_formats_form_validate($form, &$form_state) {
    $formats = system_get_date_formats('custom');
    $format = trim($form_state['values']['date_format']);
    if (!empty($formats) && in_array($format, array_keys($formats)) && (!isset($form_state['values']['dfid']) || $form_state['values']['dfid'] != $formats[$format]['dfid'])) {
        form_set_error('date_format', t('This format already exists. Enter a unique format string.'));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.