function features_admin_components in Features 6
Same name and namespace in other branches
- 7.2 features.admin.inc \features_admin_components()
- 7 features.admin.inc \features_admin_components()
Display the components of a feature.
1 string reference to 'features_admin_components'
- features_menu in ./
features.module - Implementation of hook_menu().
File
- ./
features.admin.inc, line 476
Code
function features_admin_components($form_state, $feature) {
module_load_include('inc', 'features', 'features.export');
$form = array();
// Store feature info for theme layer.
$form['module'] = array(
'#type' => 'value',
'#value' => $feature->name,
);
$form['#info'] = $feature->info;
$form['#dependencies'] = array();
if (!empty($feature->info['dependencies'])) {
foreach ($feature->info['dependencies'] as $dependency) {
$status = features_get_module_status($dependency);
$form['#dependencies'][$dependency] = $status;
}
}
$review = $revert = FALSE;
// Iterate over components and retrieve status for display
$states = features_get_component_states(array(
$feature->name,
), FALSE);
$form['revert']['#tree'] = TRUE;
foreach ($feature->info['features'] as $component => $items) {
if (user_access('administer features') && in_array($states[$feature->name][$component], array(
FEATURES_OVERRIDDEN,
FEATURES_NEEDS_REVIEW,
))) {
switch ($states[$feature->name][$component]) {
case FEATURES_OVERRIDDEN:
$revert = TRUE;
break;
case FEATURES_NEEDS_REVIEW:
$review = TRUE;
break;
}
$form['revert'][$component] = array(
'#type' => 'checkbox',
'#default_value' => FALSE,
);
}
if (module_exists('diff')) {
$item = menu_get_item("admin/build/features/{$feature->name}/diff/{$component}");
$path = $item && $item['access'] ? $item['href'] : NULL;
}
else {
$path = NULL;
}
$form['components'][$component] = array(
'#type' => 'markup',
'#value' => theme('features_storage_link', $states[$feature->name][$component], NULL, $path),
);
}
if ($review || $revert) {
$form['buttons'] = array(
'#theme' => 'features_form_buttons',
'#tree' => TRUE,
);
if ($revert || $review) {
$form['buttons']['revert'] = array(
'#type' => 'submit',
'#value' => t('Revert components'),
'#submit' => array(
'features_admin_components_revert',
),
);
}
if ($review) {
$form['buttons']['review'] = array(
'#type' => 'submit',
'#value' => t('Mark as reviewed'),
'#submit' => array(
'features_admin_components_review',
),
);
}
}
return $form;
}