You are here

function system_date_time_formats in Drupal 7

Displays the date format strings overview page.

1 string reference to 'system_date_time_formats'
system_menu in modules/system/system.module
Implements hook_menu().

File

modules/system/system.admin.inc, line 2868
Admin page callbacks for the system module.

Code

function system_date_time_formats() {
  $header = array(
    t('Format'),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );
  $rows = array();
  drupal_static_reset('system_get_date_formats');
  $formats = system_get_date_formats('custom');
  if (!empty($formats)) {
    foreach ($formats as $format) {
      $row = array();
      $row[] = array(
        'data' => format_date(REQUEST_TIME, 'custom', $format['format']),
      );
      $row[] = array(
        'data' => l(t('edit'), 'admin/config/regional/date-time/formats/' . $format['dfid'] . '/edit'),
      );
      $row[] = array(
        'data' => l(t('delete'), 'admin/config/regional/date-time/formats/' . $format['dfid'] . '/delete'),
      );
      $rows[] = $row;
    }
  }
  $build['date_formats_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('No custom date formats available. <a href="@link">Add date format</a>.', array(
      '@link' => url('admin/config/regional/date-time/formats/add'),
    )),
  );
  return $build;
}