function theme_calendar_systems_languages_overview_form in Calendar Systems 6.2
Theme callback for Locale language overview form.
It's also compatible with admin_language.module which overrides the same themer callback.
Parameters
$form: Language overview form array.
Return value
Themed output.
File
- ./
calendar_systems.admin.inc, line 246 - Implements necessary callbacks for Calendar Systems administration forms.
Code
function theme_calendar_systems_languages_overview_form($form) {
// Load helpers.
module_load_include('patch.inc', 'calendar_systems');
$rows = array();
$default = language_default();
// Set form table rows.
foreach ($form['name'] as $name => $element) {
// Skip form attributes.
if (!is_array($element) || !element_child($name)) {
continue;
}
// Make the default language checkbox disabled.
if ($name == $default->language) {
$form['enabled'][$name]['#attributes']['disabled'] = 'disabled';
}
// Loadup rows.
$rows[] = array(
array(
'align' => 'center',
'data' => drupal_render($form['enabled'][$name]),
),
check_plain($name),
'<strong>' . drupal_render($form['name'][$name]) . '</strong>',
drupal_render($form['native'][$name]),
drupal_render($form['direction'][$name]),
drupal_render($form['site_default'][$name]),
drupal_render($form['admin_language'][$name]),
drupal_render($form['calendar_systems_languages'][$name]),
drupal_render($form['weight'][$name]),
l(t('edit'), 'admin/settings/language/edit/' . $name) . ($name != 'en' && $name != $default->language ? ' ' . l(t('delete'), 'admin/settings/language/delete/' . $name) : ''),
);
}
// Set form table header.
$header = array(
t('Enabled'),
t('Code'),
t('English name'),
t('Native name'),
t('Direction'),
t('Default'),
t('Admin'),
t('Calendar'),
t('Weight'),
array(
'data' => t('Operations'),
),
);
// Remove admin_language.module options if not exist.
if (!isset($form['admin_language'][$name])) {
unset($header[6]);
$rows = array_map('array_filter', $rows);
}
// Required patches are not applied at the moment,
// all was a waste of time! We're checking the patch
// application here, it's also OK to do so in the
// implementation of hook_theme(). But that way the
// form will be unfunctional in case that the required
// patches are reverted and the theme cache is not yet
// rebuilt.
if (!_calendar_systems_patches_applied()) {
unset($header[7]);
// Temporary dirt:
foreach ($rows as $index => $row) {
unset($rows[$index][7]);
}
}
// Let it go!
$output = theme('table', $header, $rows);
$output .= drupal_render($form);
// Also add a link to default calendar configuration page.
return $output . t('<a href="!link">Configure default calendar</a>', array(
'!link' => url('admin/settings/date-time/calendars'),
));
}