You are here

function skinr_ui_skinsets_form in Skinr 6.2

Menu callback; displays a listing of all non-theme skinsets.

See also

skinr_ui_skinsets_form_submit()

1 string reference to 'skinr_ui_skinsets_form'
skinr_ui_menu in ./skinr_ui.module
Implementation of hook_menu().

File

./skinr_ui.admin.inc, line 394
Admin page callbacks for the skinr module.

Code

function skinr_ui_skinsets_form() {
  $skinsets = skinr_rebuild_skinset_data();
  uasort($skinsets, 'skinr_ui_sort_by_info_name');

  // Store module list for use in the theme function.
  $form['skinsets'] = array(
    '#type' => 'value',
    '#value' => $skinsets,
  );
  $options = array();
  $status = array();
  $incompatible_core = array();
  $incompatible_php = array();
  foreach ($skinsets as $skinset) {
    $screenshot = NULL;
    $skinset_keys = array(
      $skinset->name,
    );

    // Look for a screenshot in the current skinset.
    if (isset($skinsets[$skinset->name]) && file_exists($skinsets[$skinset->name]->info['screenshot'])) {
      $screenshot = $skinsets[$skinset->name]->info['screenshot'];
    }
    $screenshot = $screenshot ? theme('image', $screenshot, t('Screenshot for %theme theme', array(
      '%theme' => $skinset->info['name'],
    )), '', array(
      'class' => 'screenshot',
    ), FALSE) : t('no screenshot');
    $form[$skinset->name]['screenshot'] = array(
      '#value' => $screenshot,
    );
    $form[$skinset->name]['info'] = array(
      '#type' => 'value',
      '#value' => $skinset->info,
    );
    $options[$skinset->name] = '';
    if (!empty($skinset->status)) {
      $status[] = $skinset->name;
    }
    else {

      // Ensure this theme is compatible with this version of core.
      if (!isset($skinset->info['core']) || $skinset->info['core'] != DRUPAL_CORE_COMPATIBILITY) {
        $incompatible_core[] = $skinset->name;
      }
      if (version_compare(phpversion(), $skinset->info['php']) < 0) {
        $incompatible_php[$skinset->name] = $skinset->info['php'];
      }
    }
    $form[$skinset->name]['operations'] = array(
      '#value' => l('configure', 'admin/build/skinr/skins/settings/' . $skinset->name),
    );
  }
  $form['status'] = array(
    '#type' => 'checkboxes',
    '#options' => $options,
    '#default_value' => $status,
    '#incompatible_skinsets_core' => drupal_map_assoc($incompatible_core),
    '#incompatible_skinsets_php' => $incompatible_php,
  );
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  $form['buttons']['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset to defaults'),
  );
  return $form;
}