1.20.x system.admin.inc | system_date_time_formats() |
Displays the date format strings overview page.
File
- modules/
system/ system.admin.inc, line 2353 - Admin page callbacks for the System module.
Code
function system_date_time_formats() {
$header = array(
array('data' => t('Name')),
array('data' => t('Pattern')),
array('data' => t('Operations'))
);
$rows = array();
$formats = system_get_date_formats();
if (!empty($formats)) {
foreach ($formats as $date_format_name => $format_info) {
// Do not display date formats that are hidden.
if (empty($format_info['hidden'])) {
$row = array();
$row[] = theme('label_machine_name__date_format', array(
'label' => $format_info['label'],
'machine_name' => $date_format_name,
));
$row[] = array('data' => format_date(REQUEST_TIME, 'custom', $format_info['pattern']));
// Prepare Operational links.
$links = array();
$links['edit'] = array(
'title' => t('Configure'),
'href' => 'admin/config/regional/date-time/formats/' . $date_format_name . '/edit',
);
if (module_exists('locale')) {
$links['localize'] = array(
'title' => t('Localize'),
'href' => 'admin/config/regional/date-time/formats/' . $date_format_name . '/localize',
);
}
// Do not allow deletion of module-provided formats.
if (empty($format_info['module'])) {
$links['delete'] = array(
'title' => t('Delete'),
'href' => 'admin/config/regional/date-time/formats/' . $date_format_name . '/delete',
);
}
$row['operations'] = array('data' => array(
'#type' => 'operations',
'#links' => $links,
));
$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;
}