You are here

function template_preprocess_responsive_preview_admin_form in Responsive Theme Preview 7

Processes variables for responsive-preview-admin-form.tpl.php.

See also

responsive-preview-admin-form.tpl.php

File

./responsive_preview.admin.inc, line 107
Administrative page callbacks for the responsive_preview module.

Code

function template_preprocess_responsive_preview_admin_form(&$variables) {

  // Move each device defintion to a top-level variable for the template.
  foreach (element_children($variables['form']['devices']) as $i) {

    // Assign by reference so that when the renderables are rendered for each
    // device, the reference will be marked as #printed and will be ignored
    // when the children of the form key are rendered below.
    $device =& $variables['form']['devices'][$i];
    $device['weight']['#attributes']['class'] = array(
      'device-weight',
    );
    $variables['devices'][] = array(
      'label' => drupal_render($device['label']),
      'status' => drupal_render($device['status']),
      'dimensions' => drupal_render($device['dimensions']),
      'weight' => drupal_render($device['weight']),
      'edit_link' => drupal_render($device['edit']),
      'delete_link' => drupal_render($device['delete']),
    );
  }

  // The children must be rendered so that hidden fields are printed as well.
  $variables['form_submit'] = drupal_render_children($variables['form']);
}