$status) { $rows[] = array( array( 'data' => isset($modules[$dependency]->info['name']) ? $modules[$dependency]->info['name'] : $dependency, 'class' => 'component' ), theme('features_module_status', $status), ); } $vars['dependencies'] = theme('table', array(t('Dependency'), t('Status')), $rows); // Components $rows = array(); $components = features_get_components(); $conflicts = features_get_conflicts(); if (!module_exists($form['module']['#value']) && isset($form['module']['#value']) && !empty($conflicts[$form['module']['#value']])) { $module_conflicts = $conflicts[$form['module']['#value']]; $conflicts = array(); foreach ($module_conflicts as $conflict) { $conflicts = array_merge_recursive($conflict, $conflicts); } } else { $conflicts = array(); } // Display key for conflicting elements. if (!empty($conflicts)) { $vars['key'][] = array( 'title' => theme('features_storage_link', FEATURES_CONFLICT, t('Conflicts with another feature')), 'html' => TRUE, ); } if (!empty($form['#info']['features'])) { foreach ($form['#info']['features'] as $component => $items) { if (!empty($items)) { $header = $data = array(); if (element_children($form['revert'])) { $header[] = array( 'data' => isset($form['revert'][$component]) ? drupal_render($form['revert'][$component]) : '', 'header' => TRUE ); } $header[] = array( 'data' => isset($components[$component]['name']) ? $components[$component]['name'] : $component, 'header' => TRUE ); $header[] = array( 'data' => drupal_render($form['components'][$component]), 'header' => TRUE ); $rows[] = $header; if (element_children($form['revert'])) { $data[] = ''; } $component_conflicts = isset($conflicts[$component]) ? $conflicts[$component] : array(); $data[] = array( 'data' => theme('features_component_list', $items, $items, $component_conflicts), 'colspan' => 2, 'class' => 'component' ); $rows[] = $data; } } } $vars['components'] = theme('table', array(), $rows); // Other elements $vars['buttons'] = drupal_render($form['buttons']); $vars['form'] = drupal_render($form); } /** * Preprocessor for theme('features_form'). */ 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; } /** * Themes a module status display. */ function theme_features_module_status($status, $module = NULL) { switch ($status) { case FEATURES_MODULE_ENABLED: $text = !empty($module) ? $module : t('Enabled'); return "{$text}"; case FEATURES_MODULE_DISABLED: $text = !empty($module) ? $module : t('Disabled'); return "{$text}"; case FEATURES_MODULE_MISSING: $text = !empty($module) ? $module : t('Missing'); return "{$text}"; } } /** * Themes a module status display. */ function theme_features_storage_link($storage, $text = NULL, $path = NULL, $options = array()) { $classes = array( FEATURES_OVERRIDDEN => 'admin-overridden', FEATURES_DEFAULT => 'admin-default', FEATURES_NEEDS_REVIEW => 'admin-needs-review', FEATURES_REBUILDING => 'admin-rebuilding', FEATURES_REBUILDABLE => 'admin-rebuilding', FEATURES_CONFLICT => 'admin-conflict', FEATURES_DISABLED => 'admin-disabled', ); $default_text = array( FEATURES_OVERRIDDEN => t('Overridden'), FEATURES_DEFAULT => t('Default'), FEATURES_NEEDS_REVIEW => t('Needs review'), FEATURES_REBUILDING => t('Rebuilding'), FEATURES_REBUILDABLE => t('Rebuilding'), FEATURES_CONFLICT => t('Conflict'), FEATURES_DISABLED => t('Disabled'), ); $text = isset($text) ? $text : $default_text[$storage]; if ($path) { $options['attributes']['class'] = $classes[$storage] . ' features-storage'; return l($text, $path, $options); } else { return "{$text}"; } } /** * Theme function for displaying form buttons */ function theme_features_form_buttons($element) { drupal_add_css(drupal_get_path('module', 'features') .'/features.css'); $output = drupal_render($element); return !empty($output) ? "
" : ''; } /** * Theme for features management form. */ function theme_features_form_package($form) { drupal_add_css(drupal_get_path('module', 'features') .'/features.css'); drupal_add_js(drupal_get_path('module', 'features') .'/features.js'); $output = ''; $header = array('', t('Feature'), t('Signature')); if (isset($form['state'])) { $header[] = t('State'); } if (isset($form['actions'])) { $header[] = t('Actions'); } $rows = array(); foreach (element_children($form['status']) as $element) { // Yank title & description fields off the form element for // rendering in their own cells. $name = "