You are here

function theme_features_components in Features 7

Same name and namespace in other branches
  1. 6 theme/theme.inc \theme_features_components()
  2. 7.2 theme/theme.inc \theme_features_components()

Theme a set of features export components.

2 theme calls to theme_features_components()
features_export_build_form_populate in ./features.admin.inc
AJAX callback for features_export_form_build().
features_export_form in ./features.admin.inc
Form constructor for features export form.

File

theme/theme.inc, line 253

Code

function theme_features_components($vars) {
  $info = $vars['info'];
  $sources = $vars['sources'];
  $output = '';
  $rows = array();
  $components = features_get_components();
  if (!empty($info['features']) || !empty($info['dependencies']) || !empty($sources)) {
    $export = array_unique(array_merge(array_keys($info['features']), array_keys($sources), array(
      'dependencies',
    )));
    foreach ($export as $component) {
      if ($component === 'dependencies') {
        $feature_items = isset($info[$component]) ? $info[$component] : array();
      }
      else {
        $feature_items = isset($info['features'][$component]) ? $info['features'][$component] : array();
      }
      $source_items = isset($sources[$component]) ? $sources[$component] : array();
      if (!empty($feature_items) || !empty($source_items)) {
        $rows[] = array(
          array(
            'data' => isset($components[$component]['name']) ? $components[$component]['name'] : $component,
            'header' => TRUE,
          ),
        );
        $rows[] = array(
          array(
            'data' => theme('features_component_list', array(
              'components' => $feature_items,
              'source' => $source_items,
            )),
            'class' => 'component',
          ),
        );
      }
    }
    $output .= theme('table', array(
      'header' => array(),
      'rows' => $rows,
    ));
    $output .= theme('features_component_key', array());
  }
  return $output;
}