function theme_skinr_ui_skinsets_form in Skinr 6.2
Theme function for Skinr UI's skinsets form.
Parameters
$form: An associative array containing the structure of the form.
File
- ./
skinr_ui.admin.inc, line 908 - Admin page callbacks for the skinr module.
Code
function theme_skinr_ui_skinsets_form($form) {
// Individual table headers.
$header = array(
t('Screenshot'),
t('Name'),
t('Version'),
t('Enabled'),
t('Operations'),
);
// Pull package information from skinsets list and start grouping skinsets.
$skinsets = $form['skinsets']['#value'];
$packages = array();
foreach ($skinsets as $skinset) {
if (!isset($skinset->info['package']) || !$skinset->info['package']) {
$skinset->info['package'] = t('Other');
}
$packages[$skinset->info['package']][$skinset->name] = $skinset->info;
}
ksort($packages);
// Display packages.
$output = '';
foreach ($packages as $package => $skinsets) {
$rows = array();
foreach ($skinsets as $key => $skinset) {
// Only look for skinsets.
if (!isset($form[$key]['info'])) {
continue;
}
// Fetch info.
$info = $form[$key]['info']['#value'];
// Localize skinset description.
$description = t($info['description']);
// Make sure it is compatible and render the checkbox if so.
if (isset($form['status']['#incompatible_skinsets_core'][$key])) {
unset($form['status'][$key]);
$status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of Drupal core'));
$description .= '<div class="incompatible">' . t('This version is incompatible with the !core_version version of Drupal core.', array(
'!core_version' => VERSION,
)) . '</div>';
}
elseif (isset($form['status']['#incompatible_skinsets_php'][$key])) {
unset($form['status'][$key]);
$status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of PHP'));
$php_required = $form['status']['#incompatible_themes_php'][$key];
if (substr_count($php_required, '.') < 2) {
$php_required .= '.*';
}
$description .= '<div class="incompatible">' . t('This skinset requires PHP version @php_required and is incompatible with PHP version !php_version.', array(
'@php_required' => $php_required,
'!php_version' => phpversion(),
)) . '</div>';
}
else {
$status = drupal_render($form['status'][$key]);
}
// Style theme info
$content = '<div class="skinset-info"><h2>' . $info['name'] . '</h2><div class="description">' . $description . '</div></div>';
// Build rows
$row = array();
$row[] = drupal_render($form[$key]['screenshot']);
$row[] = $content;
$row[] = isset($info['version']) ? $info['version'] : '';
$row[] = array(
'data' => $status,
'align' => 'center',
);
$row[] = array(
'data' => drupal_render($form[$key]['operations']),
'align' => 'center',
);
$rows[] = $row;
}
$fieldset = array(
'#title' => t($package),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#value' => theme('table', $header, $rows, array(
'class' => 'package',
)),
);
$output .= theme('fieldset', $fieldset);
}
$output .= drupal_render($form);
return $output;
}