You are here

function template_preprocess_better_formats_defaults_admin_form in Better Formats 6

Same name and namespace in other branches
  1. 6.2 better_formats_defaults.admin.inc \template_preprocess_better_formats_defaults_admin_form()
  2. 7 better_formats.admin_defaults.inc \template_preprocess_better_formats_defaults_admin_form()

Process variables for better-defaults-admin-form.tpl.php.

Parameters

$vars: The $variables array contains the following arguments:

  • $form

File

./better_formats_defaults.admin.inc, line 219
Contains FAPI and theme functions for the format defaults form.

Code

function template_preprocess_better_formats_defaults_admin_form(&$vars) {
  foreach (element_children($vars['form']) as $key) {
    $form_row =& $vars['form'][$key];

    //$type = strpos($key, 'node-') === 0 ? 'node' : 'comment';
    $type = substr($key, 0, strpos($key, '-'));
    if (isset($form_row['role'])) {

      // Set special classes needed for table drag and drop.
      $form_row['weight']['#attributes']['class'] = 'better-formats-role-' . $type . '-weight';
      $row = new stdClass();
      $row->role = drupal_render($form_row['role']);
      $row->format_select = drupal_render($form_row['format']);
      $row->weight_select = drupal_render($form_row['weight']);
      $vars[$type . '_default_rows'][$key] = $row;
    }
  }
  $vars['form_submit'] = drupal_render($vars['form']);
}