You are here

function template_preprocess_delta_theme_overrides_form in Delta 7

Same name and namespace in other branches
  1. 6 delta.module \template_preprocess_delta_theme_overrides_form()

Preprocess functionality for the Delta Overrides form

Parameters

$vars:

File

./delta.module, line 341
The Delta Theme API is an advanced manipulation of the Theme Settings API to allow for customization/configuration of theme settings based on node types, context, or groups of paths.

Code

function template_preprocess_delta_theme_overrides_form(&$vars) {
  foreach (element_children($vars['form']) as $i) {
    $delta =& $vars['form'][$i];
    if (isset($delta['#info'])) {

      // Set special classes needed for table drag and drop.
      $vars['form'][$i]['weight']['#attributes']['class'] = 'delta-weight';
      $vars['delta_listing'][$i]->row_class = isset($delta['#attributes']['class']) ? $delta['#attributes']['class'] : '';
      $vars['delta_listing'][$i]->name = drupal_render($delta['name']);

      /*
       * @todo
       * This will need to be generated by pulling the unserialized data from
       * the value field, and seeing what types it applies to
       * structure change
       */
      $vars['delta_listing'][$i]->types = drupal_render($delta['types']);
      $vars['delta_listing'][$i]->weight_select = drupal_render($delta['weight']);
      $vars['delta_listing'][$i]->theme_settings_template = drupal_render($delta['theme_settings_template']);
      $vars['delta_listing'][$i]->edit_link = drupal_render($delta['edit']);
      $vars['delta_listing'][$i]->delete_link = !empty($delta['delete']) ? drupal_render($delta['delete']) : '';
      $vars['delta_listing'][$i]->export_link = drupal_render($delta['export']);
      $vars['delta_listing'][$i]->add_template_link = drupal_render($delta['add_template']);
      $vars['delta_listing'][$i]->printed = FALSE;
    }
  }
  $vars['form_submit'] = drupal_render($vars['form']);

  // set the default add template link
  $theme = $vars['form']['theme']['#value'];
  $vars['default_add_override_link'] = l(t('add new override'), 'admin/build/delta/add-template/' . $theme);
  drupal_add_js('misc/tableheader.js');
  drupal_add_tabledrag('delta-overrides', 'order', 'sibling', 'delta-weight');
}