$status) { $rows[] = array( array( 'data' => isset($modules[$dependency]->info['name']) ? $modules[$dependency]->info['name'] : $dependency, 'class' => 'component' ), theme('features_module_status', array('status' => $status)), ); } $vars['dependencies'] = theme('table', array('header' => array(t('Dependency'), t('Status')), 'rows' => $rows)); // Components $rows = array(); $components = features_get_components(); // Display key for conflicting elements. if (!empty($form['#conflicts'])) { $vars['key'][] = array( 'title' => theme('features_storage_link', array('storage' => FEATURES_CONFLICT, 'text' => t('Conflicts with another feature'))), 'html' => TRUE, ); } if (!empty($form['#info']['features'])) { foreach ($form['#info']['features'] as $component => $items) { if (!empty($items)) { $conflicts = array_key_exists($component, $form['#conflicts']) ? $form['#conflicts'][$component] : NULL; $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[] = ''; } $data[] = array( 'data' => theme('features_component_list', array('components' => $items, 'source' => $items, 'conflicts' => $conflicts)), 'colspan' => 2, 'class' => 'component' ); $rows[] = $data; } } } $vars['components'] = theme('table', array('header' => array(), 'rows' => $rows)); // Other elements $vars['buttons'] = drupal_render($form['buttons']); $vars['form'] = $form; $vars['lock_feature'] = theme('features_lock_link', array('feature' => $form['#feature']->name)); } /** * Themes a module status display. */ function theme_features_module_status($vars) { switch ($vars['status']) { case FEATURES_MODULE_ENABLED: $text_status = t('Enabled'); $class = 'admin-enabled'; break; case FEATURES_MODULE_DISABLED: $text_status = t('Disabled'); $class = 'admin-disabled'; break; case FEATURES_MODULE_MISSING: $text_status = t('Missing'); $class = 'admin-missing'; break; case FEATURES_MODULE_CONFLICT: $text_status = t('Enabled'); $class = 'admin-conflict'; break; } $text = !empty($vars['module']) ? $vars['module'] . ' (' . $text_status . ')' : $text_status; return "$text"; } /** * Themes a lock link */ function theme_features_lock_link($vars) { drupal_add_library('system', 'ui'); drupal_add_library('system', 'drupal.ajax'); $component = $vars['component'] ? $vars['component'] : ''; if ($component && features_component_is_locked($component)) { return l(t('Component locked'), 'admin/structure/features/settings', array( 'attributes' => array( 'class' => 'features-lock-icon ui-icon ui-icon-locked', 'title' => t('This component is locked on a global level.'), ), 'fragment' => 'edit-lock-components', )); } $feature = $vars['feature']; $is_locked = features_feature_is_locked($feature, $component); $options = array( 'attributes' => array( 'class' => array('use-ajax features-lock-icon ui-icon ' . ($is_locked ? ' ui-icon-locked' : ' ui-icon-unlocked')), 'id' => 'features-lock-link-' . $feature . ($component ? '-' . $component : ''), 'title' => $is_locked ? t('This item is locked and features will not be rebuilt or reverted.') : t('This item is unlocked and will be rebuilt/reverted as normal.'), ), 'query' => array('token' => drupal_get_token('features/' . $feature . '/' . $component)), ); $path = "admin/structure/features/" . $feature . "/lock/nojs" . ($component ? '/' . $component: ''); return l($is_locked ? t('UnLock') : t('Lock'), $path, $options); } /** * Themes a module status display. */ function theme_features_storage_link($vars) { $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', FEATURES_CHECKING => 'admin-loading', ); $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'), FEATURES_CHECKING => t('Checking...'), ); $text = isset($vars['text']) ? $vars['text'] : $default_text[$vars['storage']]; if ($vars['path']) { $vars['options']['attributes']['class'][] = $classes[$vars['storage']]; $vars['options']['attributes']['class'][] = 'features-storage'; return l($text, $vars['path'], $vars['options']); } else { return "{$text}"; } } /** * Theme function for displaying form buttons */ function theme_features_form_buttons(&$vars) { drupal_add_css(drupal_get_path('module', 'features') . '/features.css'); $output = drupal_render_children($vars['element']); return !empty($output) ? "
" : ''; } /** * Theme for features management form. */ function theme_features_form_package(&$vars) { 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($vars['form']['state'])) { $header[] = t('State'); } if (isset($vars['form']['actions'])) { $header[] = t('Actions'); } $rows = array(); foreach (element_children($vars['form']['status']) as $element) { // Yank title & description fields off the form element for // rendering in their own cells. $name = "