function template_preprocess_features_admin_components in Features 7
Same name and namespace in other branches
- 6 theme/theme.inc \template_preprocess_features_admin_components()
- 7.2 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', 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;
}