You are here

function theme_skinr_ui_skinsets_settings_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 990
Admin page callbacks for the skinr module.

Code

function theme_skinr_ui_skinsets_settings_form($form) {

  // Individual table headers.
  $header = array(
    t('Enabled'),
    t('Name'),
    t('Operations'),
  );

  // Display skins.
  $output = '';

  // Get current theme, but make sure it's not the admin theme when we're editing with AJAX.
  $current_theme = skinr_current_theme(TRUE);
  $themes = list_themes();
  ksort($themes);
  foreach ($themes as $theme) {
    if (!$theme->status) {
      continue;
    }
    $rows = array();
    foreach ($form as $key => $skin) {

      // Only look for skins.
      if (!is_array($form[$key]) || !isset($form[$key]['info'])) {
        continue;
      }

      // Fetch info.
      $info = $form[$key]['info']['#value'];

      // Localize skinset title and description.
      $title = t($info['title']);
      $description = t($info['description']);

      // The hooks this skin is working with.
      $features = array();
      foreach ($info['features'] as $feature) {
        $features[] = $feature == '*' ? t('all hooks') : $feature;
      }
      $features = t('Used by: !features', array(
        '!features' => implode(', ', $features),
      ));
      $status = drupal_render($form[$key]['status'][$theme->name]);

      // Style theme info
      $content = '<div class="skin-info"><h2>' . $title . '</h2><div class="description">' . $description . '</div><div class="features">' . $features . '</div></div>';

      // Build rows
      $row = array();
      $row[] = array(
        'data' => $status,
        'align' => 'center',
      );
      $row[] = $content;
      $row[] = array(
        'data' => drupal_render($form[$key]['operations']),
        'align' => 'center',
      );
      $rows[] = $row;
    }
    $fieldset = array(
      '#title' => t($theme->info['name']),
      '#collapsible' => TRUE,
      '#collapsed' => $theme->name == $current_theme ? FALSE : TRUE,
      '#value' => theme('table', $header, $rows, array(
        'class' => 'theme',
      )),
    );
    $output .= theme('fieldset', $fieldset);
  }
  $output .= drupal_render($form);
  return $output;
}