Displays the date format strings overview page.
function system_date_time_formats() {
$header = array(
array(
'data' => t('Machine name'),
'field' => 'machine_name',
),
array(
'data' => t('Name'),
'field' => 'name',
),
array(
'data' => t('Pattern'),
'field' => 'pattern',
),
array(
'data' => t('Operations'),
),
);
$rows = array();
$formats = system_get_date_formats();
if (!empty($formats)) {
foreach ($formats as $date_format_id => $format_info) {
// Do not display date formats that are locked.
if (empty($format_info['locked'])) {
$row = array();
$row[] = array(
'data' => $date_format_id,
);
$row[] = array(
'data' => $format_info['name'],
);
$row[] = array(
'data' => format_date(REQUEST_TIME, $date_format_id),
);
// Prepare Operational links.
$links = array();
$links['edit'] = array(
'title' => t('edit'),
'href' => 'admin/config/regional/date-time/formats/' . $date_format_id . '/edit',
);
$links['delete'] = array(
'title' => t('delete'),
'href' => 'admin/config/regional/date-time/formats/' . $date_format_id . '/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;
}