You are here

function template_preprocess_features_form in Features 6

Preprocessor for theme('features_form').

File

theme/theme.inc, line 96

Code

function template_preprocess_features_form(&$vars) {
  drupal_add_css(drupal_get_path('module', 'features') . '/features.css');
  drupal_add_js(drupal_get_path('module', 'features') . '/features.js');
  $first = TRUE;
  $package_links = array();
  $packages = element_children($vars['form']);
  sort($packages);
  foreach ($packages as $package) {
    if (!empty($vars['form'][$package]['status'])) {
      $package_links[$package] = array(
        'title' => $vars['form'][$package]['#title'],
        'href' => $_GET['q'],
        'fragment' => $package,
      );
      $class = $first ? "{$package} features-package-active" : $package;
      $package_links[$package]['attributes'] = $first ? array(
        'class' => 'features-package-active',
      ) : array();
      $vars['packages'][$class] = $vars['form'][$package];
      unset($vars['form'][$package]);
      $first = FALSE;
    }
  }
  $vars['package_links'] = $package_links;
}