Projet

Général

Profil

Paste
Télécharger (1,6 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / sweaver / plugins / sweaver_plugin_editor / sweaver_plugin_editor.theme.inc @ 651307cd

1
<?php
2

    
3
/**
4
 * @file
5
 * Sweaver theming functions.
6
 */
7

    
8
/**
9
 * Editor properties drag and drop configuration form.
10
 */
11
function template_preprocess_sweaver_plugin_editor_config_editor(&$vars) {
12
  $form = &$vars['form'];
13
  $rows = array();
14

    
15
  // Iterate containers.
16
  foreach ($form['#containers'] as $container_key => $container_name) {
17

    
18
    drupal_add_tabledrag('properties', 'match', 'sibling', 'property-container-select', 'property-container-'. $container_key, NULL, TRUE);
19
    drupal_add_tabledrag('properties', 'order', 'sibling', 'property-weight', 'property-weight-'. $container_key, NULL, TRUE);
20

    
21
    $rows[$container_key]['textfield'] = drupal_render($form['container_form_'. $container_key]);
22

    
23
    // Iterate over properties in this container.
24
    if (isset($form['#properties_region'][$container_key])) {
25
      ksort($form['#properties_region'][$container_key]);
26
      foreach ($form['#properties_region'][$container_key] as $property_key => $property) {
27
        $row = new stdClass;
28
        $row->name = drupal_render($form[$property]['name']);
29
        $row->weight = drupal_render($form[$property]['weight']);
30
        $row->container = drupal_render($form[$property]['container']);
31
        $rows[$container_key]['properties'][$property] = $row;
32
      }
33
    }
34
  }
35

    
36
  $vars['rows'] = $rows;
37
  $vars['submit'] = drupal_render_children($form);
38

    
39
  drupal_add_js('misc/tableheader.js');
40
  drupal_add_css(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_editor/sweaver_plugin_editor.admin.css');
41
  drupal_add_js(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_editor/sweaver_plugin_editor.admin.js');
42
}