function template_preprocess_features_admin_components in Features 6
Same name and namespace in other branches
- 7.2 theme/theme.inc \template_preprocess_features_admin_components()
- 7 theme/theme.inc \template_preprocess_features_admin_components()
Display feature component info
File
- theme/
theme.inc, line 6
Code
function template_preprocess_features_admin_components(&$vars) {
drupal_add_css(drupal_get_path('module', 'features') . '/features.css');
$form = $vars['form'];
// Basic info
$vars['name'] = $form['#info']['name'];
$vars['description'] = isset($form['#info']['description']) ? $form['#info']['description'] : '';
// Legend/key
$vars['key'] = array();
// Dependencies
$rows = array();
$modules = features_get_info();
foreach ($form['#dependencies'] as $dependency => $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);
}