function system_date_time_lookup

Ajax callback; Returns the date for a given format string.

2 string references to 'system_date_time_lookup'
system_configure_date_formats_form in drupal/core/modules/system/system.admin.inc
Allow users to add additional date formats.
system_menu in drupal/core/modules/system/system.module
Implements hook_menu().

File

drupal/core/modules/system/system.admin.inc, line 2826
Admin page callbacks for the system module.

Code

function system_date_time_lookup($form, &$form_state) {
  $format = '';
  if (!empty($form_state['values']['date_format_pattern'])) {
    $format = t('Displayed as %date_format', array(
      '%date_format' => format_date(REQUEST_TIME, 'custom', $form_state['values']['date_format_pattern']),
    ));
  }

  // Return a command instead of a string, since the Ajax framework
  // automatically prepends an additional empty DIV element for a string, which
  // breaks the layout.
  $commands[] = ajax_command_replace('#edit-date-format-suffix', '<small id="edit-date-format-suffix">' . $format . '</small>');
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}