Passed
Pull Request — master (#2976)
by Serghei
14:27
created
drupal/sites/default/boinc/modules/contrib/cck/includes/content.diff.inc 3 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -12,40 +12,40 @@  discard block
 block discarded – undo
12 12
  * Implementation of hook_diff()
13 13
  */
14 14
 function content_diff($old_node, $new_node) {
15
-  $result = array();
16
-  // Prevent against invalid 'nodes' built by broken 3rd party code.
17
-  if (isset($new_node->type)) {
15
+    $result = array();
16
+    // Prevent against invalid 'nodes' built by broken 3rd party code.
17
+    if (isset($new_node->type)) {
18 18
     $type = content_types($new_node->type);
19 19
     $field_types = _content_field_types();
20 20
     foreach ($type['fields'] as $field) {
21
-      // Ignore fields the current user is not allowed to view.
22
-      if (!content_access('view', $field, NULL, $new_node)) {
21
+        // Ignore fields the current user is not allowed to view.
22
+        if (!content_access('view', $field, NULL, $new_node)) {
23 23
         continue;
24
-      }
25
-      $function = $field_types[$field['type']]['module'] . '_content_diff_values';
26
-      $function = function_exists($function) ? $function : 'content_content_diff_values';
27
-      $old_values = array();
28
-      $new_values = array();
29
-      if (isset($old_node->$field['field_name'])) {
24
+        }
25
+        $function = $field_types[$field['type']]['module'] . '_content_diff_values';
26
+        $function = function_exists($function) ? $function : 'content_content_diff_values';
27
+        $old_values = array();
28
+        $new_values = array();
29
+        if (isset($old_node->$field['field_name'])) {
30 30
         $old_values = $function($old_node, $field, $old_node->$field['field_name']);
31
-      }
32
-      if (isset($new_node->$field['field_name'])) {
31
+        }
32
+        if (isset($new_node->$field['field_name'])) {
33 33
         $new_values = $function($new_node, $field, $new_node->$field['field_name']);
34
-      }
35
-      if ($old_values || $new_values) {
34
+        }
35
+        if ($old_values || $new_values) {
36 36
         $result[$field['field_name']] = array(
37
-          '#name' => $field['widget']['label'],
38
-          '#old' => $old_values,
39
-          '#new' => $new_values,
40
-          '#weight' => $field['widget']['weight'],
41
-          '#format' => array(
37
+            '#name' => $field['widget']['label'],
38
+            '#old' => $old_values,
39
+            '#new' => $new_values,
40
+            '#weight' => $field['widget']['weight'],
41
+            '#format' => array(
42 42
             'show_header' => FALSE,
43
-          ),
43
+            ),
44 44
         );
45
-      }
45
+        }
46 46
     }
47
-  }
48
-  return $result;
47
+    }
48
+    return $result;
49 49
 }
50 50
 
51 51
 /**
@@ -54,75 +54,75 @@  discard block
 block discarded – undo
54 54
  * Note that diff.module takes care of running check_plain on the output.
55 55
  */
56 56
 function content_content_diff_values($node, $field, $items) {
57
-  $return = array();
58
-  foreach ($items as $item) {
57
+    $return = array();
58
+    foreach ($items as $item) {
59 59
     foreach (explode("\n", $item['value']) as $i) {
60
-      $return[] = $i;
60
+        $return[] = $i;
61
+    }
61 62
     }
62
-  }
63
-  return $return;
63
+    return $return;
64 64
 }
65 65
 
66 66
 if (module_exists('userreference')) {
67
-  /**
68
-   * Implementation of hook_content_diff_values.
69
-   */
70
-  function userreference_content_diff_values($node, $field, $items) {
67
+    /**
68
+     * Implementation of hook_content_diff_values.
69
+     */
70
+    function userreference_content_diff_values($node, $field, $items) {
71 71
     static $titles = array();
72 72
     // Gather ids.
73 73
     $ids = array();
74 74
     foreach ($items as $item) {
75
-      if ($item['uid'] && is_numeric($item['uid'])) {
75
+        if ($item['uid'] && is_numeric($item['uid'])) {
76 76
         $ids[] = $item['uid'];
77
-      }
77
+        }
78 78
     }
79 79
     // Fetch titles we don't know yet.
80 80
     $queried_ids = array_diff($ids, array_keys($titles));
81 81
     if ($queried_ids) {
82
-      $result = db_query('SELECT uid, name FROM {users} WHERE uid IN ('. db_placeholders($queried_ids) .')', $queried_ids);
83
-      while ($row = db_fetch_array($result)) {
82
+        $result = db_query('SELECT uid, name FROM {users} WHERE uid IN ('. db_placeholders($queried_ids) .')', $queried_ids);
83
+        while ($row = db_fetch_array($result)) {
84 84
         $titles[$row['uid']] = $row['name'];
85
-      }
85
+        }
86 86
     }
87 87
     // Return result.
88 88
     $return = array();
89 89
     foreach ($items as $item) {
90
-      if ($item['uid'] && isset($titles[$item['uid']])) {
90
+        if ($item['uid'] && isset($titles[$item['uid']])) {
91 91
         $return[] = $titles[$item['uid']];
92
-      }
92
+        }
93 93
     }
94 94
     return $return;
95
-  }
95
+    }
96 96
 }
97 97
 
98 98
 if (module_exists('nodereference')) {
99
-  /**
100
-   * Implementation of hook_content_diff_values.
101
-   */
102
-  function nodereference_content_diff_values($node, $field, $items) {
99
+    /**
100
+     * Implementation of hook_content_diff_values.
101
+     */
102
+    function nodereference_content_diff_values($node, $field, $items) {
103 103
     static $titles = array();
104 104
     // Gather ids.
105 105
     $ids = array();
106 106
     foreach ($items as $item) {
107
-      if ($item['nid'] && is_numeric($item['nid'])) {
107
+        if ($item['nid'] && is_numeric($item['nid'])) {
108 108
         $ids[] = $item['nid'];
109
-      }
109
+        }
110 110
     }
111 111
     // Fetch titles we don't know yet.
112 112
     $queried_ids = array_diff($ids, array_keys($titles));
113 113
     if ($queried_ids) {
114
-      $result = db_query('SELECT nid, title FROM {node} WHERE nid IN ('. db_placeholders($queried_ids) .')', $queried_ids);
115
-      while ($row = db_fetch_array($result)) {
114
+        $result = db_query('SELECT nid, title FROM {node} WHERE nid IN ('. db_placeholders($queried_ids) .')', $queried_ids);
115
+        while ($row = db_fetch_array($result)) {
116 116
         $titles[$row['nid']] = $row['title'];
117
-      }
117
+        }
118 118
     }
119 119
     // Return result.
120 120
     $return = array();
121 121
     foreach ($items as $item) {
122
-      if ($item['nid'] && isset($titles[$item['nid']])) {
122
+        if ($item['nid'] && isset($titles[$item['nid']])) {
123 123
         $return[] = $titles[$item['nid']];
124
-      }
124
+        }
125 125
     }
126 126
     return $return;
127
-  }
127
+    }
128 128
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
       if (!content_access('view', $field, NULL, $new_node)) {
23 23
         continue;
24 24
       }
25
-      $function = $field_types[$field['type']]['module'] . '_content_diff_values';
25
+      $function = $field_types[$field['type']]['module'].'_content_diff_values';
26 26
       $function = function_exists($function) ? $function : 'content_content_diff_values';
27 27
       $old_values = array();
28 28
       $new_values = array();
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     // Fetch titles we don't know yet.
80 80
     $queried_ids = array_diff($ids, array_keys($titles));
81 81
     if ($queried_ids) {
82
-      $result = db_query('SELECT uid, name FROM {users} WHERE uid IN ('. db_placeholders($queried_ids) .')', $queried_ids);
82
+      $result = db_query('SELECT uid, name FROM {users} WHERE uid IN ('.db_placeholders($queried_ids).')', $queried_ids);
83 83
       while ($row = db_fetch_array($result)) {
84 84
         $titles[$row['uid']] = $row['name'];
85 85
       }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     // Fetch titles we don't know yet.
112 112
     $queried_ids = array_diff($ids, array_keys($titles));
113 113
     if ($queried_ids) {
114
-      $result = db_query('SELECT nid, title FROM {node} WHERE nid IN ('. db_placeholders($queried_ids) .')', $queried_ids);
114
+      $result = db_query('SELECT nid, title FROM {node} WHERE nid IN ('.db_placeholders($queried_ids).')', $queried_ids);
115 115
       while ($row = db_fetch_array($result)) {
116 116
         $titles[$row['nid']] = $row['title'];
117 117
       }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     $field_types = _content_field_types();
20 20
     foreach ($type['fields'] as $field) {
21 21
       // Ignore fields the current user is not allowed to view.
22
-      if (!content_access('view', $field, NULL, $new_node)) {
22
+      if (!content_access('view', $field, null, $new_node)) {
23 23
         continue;
24 24
       }
25 25
       $function = $field_types[$field['type']]['module'] . '_content_diff_values';
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
           '#new' => $new_values,
40 40
           '#weight' => $field['widget']['weight'],
41 41
           '#format' => array(
42
-            'show_header' => FALSE,
42
+            'show_header' => false,
43 43
           ),
44 44
         );
45 45
       }
Please login to merge, or discard this patch.
sites/default/boinc/modules/contrib/cck/includes/content.node_form.inc 5 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
  * chosen widget.
10 10
  */
11 11
 function content_form(&$form, &$form_state) {
12
-  $type = content_types($form['type']['#value']);
13
-  foreach ($type['fields'] as $field_name => $field) {
12
+    $type = content_types($form['type']['#value']);
13
+    foreach ($type['fields'] as $field_name => $field) {
14 14
     $form['#field_info'][$field['field_name']] = $field;
15 15
     $form += (array) content_field_form($form, $form_state, $field);
16
-  }
17
-  return $form;
16
+    }
17
+    return $form;
18 18
 }
19 19
 
20 20
 /**
@@ -36,18 +36,18 @@  discard block
 block discarded – undo
36 36
  *   function will return the entire $field form element.
37 37
  */
38 38
 function content_field_form(&$form, &$form_state, $field, $get_delta = NULL) {
39
-  $form['#cache'] = FALSE;
40
-  $node = $form['#node'];
41
-  $addition = array();
42
-  $form_element = array();
43
-  $field_name = $field['field_name'];
44
-
45
-  $items = array();
46
-
47
-  // TODO: is the "if (function_exists($function)) {" needed ?
48
-  // defining the $function here makes it unclear where it is actually called
49
-  $function = $field['widget']['module'] .'_widget';
50
-  if (function_exists($function)) {
39
+    $form['#cache'] = FALSE;
40
+    $node = $form['#node'];
41
+    $addition = array();
42
+    $form_element = array();
43
+    $field_name = $field['field_name'];
44
+
45
+    $items = array();
46
+
47
+    // TODO: is the "if (function_exists($function)) {" needed ?
48
+    // defining the $function here makes it unclear where it is actually called
49
+    $function = $field['widget']['module'] .'_widget';
50
+    if (function_exists($function)) {
51 51
     // Prepare the values to be filled in the widget.
52 52
     // We look in the following places:
53 53
     // - Form submitted values
@@ -55,88 +55,88 @@  discard block
 block discarded – undo
55 55
     //   creating a new node translation)
56 56
     // - Default values set for the field (when creating a new node).
57 57
     if (!empty($form_state['values'][$field['field_name']])) {
58
-      $items = $form_state['values'][$field['field_name']];
59
-      // If there was an AHAH add more button in this field, don't save it.
60
-      unset($items[$field['field_name'] .'_add_more']);
58
+        $items = $form_state['values'][$field['field_name']];
59
+        // If there was an AHAH add more button in this field, don't save it.
60
+        unset($items[$field['field_name'] .'_add_more']);
61 61
     }
62 62
     elseif (!empty($node->$field['field_name'])) {
63
-      $items = $node->$field['field_name'];
63
+        $items = $node->$field['field_name'];
64 64
     }
65 65
     elseif (empty($node->nid)) {
66
-      if (content_callback('widget', 'default value', $field) != CONTENT_CALLBACK_NONE) {
66
+        if (content_callback('widget', 'default value', $field) != CONTENT_CALLBACK_NONE) {
67 67
         // If a module wants to insert custom default values here,
68 68
         // it should provide a hook_default_value() function to call,
69 69
         // otherwise the content module's content_default_value() function
70 70
         // will be used.
71 71
         $callback = content_callback('widget', 'default value', $field) == CONTENT_CALLBACK_CUSTOM ? $field['widget']['module'] .'_default_value' : 'content_default_value';
72 72
         if (function_exists($callback)) {
73
-          $items = $callback($form, $form_state, $field, 0);
73
+            $items = $callback($form, $form_state, $field, 0);
74
+        }
74 75
         }
75
-      }
76 76
     }
77 77
 
78 78
     // See if access to this form element is restricted,
79 79
     // if so, skip widget processing and just set the value.
80 80
     $access = content_access('edit', $field, NULL, $node);
81 81
     if (!$access) {
82
-      $addition[$field_name] = array(
82
+        $addition[$field_name] = array(
83 83
         '#access' => $access,
84 84
         '#type' => 'value',
85 85
         '#value' => $items,
86
-      );
87
-      return $addition;
86
+        );
87
+        return $addition;
88 88
     }
89 89
 
90 90
     // If content module handles multiple values for this form element,
91 91
     // and not selecting an individual $delta, process the multiple value form.
92 92
     if (!isset($get_delta) && content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
93
-      $form_element = content_multiple_value_form($form, $form_state, $field, $items);
93
+        $form_element = content_multiple_value_form($form, $form_state, $field, $items);
94 94
     }
95 95
     // If the widget is handling multiple values (e.g optionwidgets),
96 96
     // or selecting an individual element, just get a single form
97 97
     // element and make it the $delta value.
98 98
     else {
99
-      $delta = isset($get_delta) ? $get_delta : 0;
100
-      if ($element = $function($form, $form_state, $field, $items, $delta)) {
99
+        $delta = isset($get_delta) ? $get_delta : 0;
100
+        if ($element = $function($form, $form_state, $field, $items, $delta)) {
101 101
         $title = check_plain(t($field['widget']['label']));
102 102
         $description = content_filter_xss(t($field['widget']['description']));
103 103
         $defaults = array(
104
-          '#required' => $get_delta > 0 ? FALSE : $field['required'],
105
-          '#columns'  => array_keys($field['columns']),
106
-          '#title' => $title,
107
-          '#description' => $description,
108
-          '#delta' => $delta,
109
-          '#field_name' => $field['field_name'],
110
-          '#type_name' => $field['type_name'],
104
+            '#required' => $get_delta > 0 ? FALSE : $field['required'],
105
+            '#columns'  => array_keys($field['columns']),
106
+            '#title' => $title,
107
+            '#description' => $description,
108
+            '#delta' => $delta,
109
+            '#field_name' => $field['field_name'],
110
+            '#type_name' => $field['type_name'],
111 111
         );
112 112
         // If we're processing a specific delta value for a field where the
113 113
         // content module handles multiples, set the delta in the result.
114 114
         // For fields that handle their own processing, we can't make assumptions
115 115
         // about how the field is structured, just merge in the returned value.
116 116
         if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
117
-          $form_element[$delta] = array_merge($element, $defaults);
117
+            $form_element[$delta] = array_merge($element, $defaults);
118 118
         }
119 119
         else {
120
-          $form_element = array_merge($element, $defaults);
120
+            $form_element = array_merge($element, $defaults);
121
+        }
121 122
         }
122
-      }
123 123
     }
124 124
 
125 125
     // Field name is needed at top level as well as the individual elements
126 126
     // so the multiple values or other field level theme or processing can find it.
127 127
     if ($form_element) {
128
-      $defaults = array(
128
+        $defaults = array(
129 129
         '#field_name' => $field['field_name'],
130 130
         '#tree' => TRUE,
131 131
         '#weight' => $field['widget']['weight'],
132 132
         '#access' => $access,
133 133
         // TODO: what's the need for #count ? does not seem to be used anywhere ?
134 134
         '#count' => count($form_element),
135
-      );
136
-      $addition[$field['field_name']] = array_merge($form_element, $defaults);
135
+        );
136
+        $addition[$field['field_name']] = array_merge($form_element, $defaults);
137
+    }
137 138
     }
138
-  }
139
-  return $addition;
139
+    return $addition;
140 140
 }
141 141
 
142 142
 /**
@@ -148,42 +148,42 @@  discard block
 block discarded – undo
148 148
  * - drag-n-drop value reordering
149 149
  */
150 150
 function content_multiple_value_form(&$form, &$form_state, $field, $items) {
151
-  $field_name = $field['field_name'];
151
+    $field_name = $field['field_name'];
152 152
 
153
-  switch ($field['multiple']) {
153
+    switch ($field['multiple']) {
154 154
     case 0:
155 155
       $max = 0;
156
-      break;
156
+        break;
157 157
     case 1:
158 158
       $filled_items = content_set_empty($field, $items);
159
-      $current_item_count = isset($form_state['item_count'][$field_name])
159
+        $current_item_count = isset($form_state['item_count'][$field_name])
160 160
                             ? $form_state['item_count'][$field_name]
161 161
                             : count($items);
162
-      // We always want at least one empty icon for the user to fill in.
163
-      $max = ($current_item_count > count($filled_items))
162
+        // We always want at least one empty icon for the user to fill in.
163
+        $max = ($current_item_count > count($filled_items))
164 164
               ? $current_item_count - 1
165 165
               : $current_item_count;
166 166
 
167
-      break;
167
+        break;
168 168
     default:
169 169
       $max = $field['multiple'] - 1;
170
-      break;
171
-  }
170
+        break;
171
+    }
172 172
 
173
-  $title = check_plain(t($field['widget']['label']));
174
-  $description = content_filter_xss(t($field['widget']['description']));
173
+    $title = check_plain(t($field['widget']['label']));
174
+    $description = content_filter_xss(t($field['widget']['description']));
175 175
 
176
-  $form_element = array(
176
+    $form_element = array(
177 177
     '#theme' => 'content_multiple_values',
178 178
     '#title' => $title,
179 179
     '#required' => $field['required'],
180 180
     '#description' => $description,
181
-  );
182
-  $function = $field['widget']['module'] .'_widget';
181
+    );
182
+    $function = $field['widget']['module'] .'_widget';
183 183
 
184
-  for ($delta = 0; $delta <= $max; $delta++) {
184
+    for ($delta = 0; $delta <= $max; $delta++) {
185 185
     if ($element = $function($form, $form_state, $field, $items, $delta)) {
186
-      $defaults = array(
186
+        $defaults = array(
187 187
         '#title' => ($field['multiple'] >= 1) ? '' : $title,
188 188
         '#description' => ($field['multiple'] >= 1) ? '' : $description,
189 189
         '#required' => $delta == 0 && $field['required'],
@@ -192,51 +192,51 @@  discard block
 block discarded – undo
192 192
         '#columns' => array_keys($field['columns']),
193 193
         '#field_name' => $field_name,
194 194
         '#type_name' => $field['type_name'],
195
-      );
195
+        );
196 196
 
197
-      // Add an input field for the delta (drag-n-drop reordering), which will
198
-      // be hidden by tabledrag js behavior.
199
-      if ($field['multiple'] >= 1) {
197
+        // Add an input field for the delta (drag-n-drop reordering), which will
198
+        // be hidden by tabledrag js behavior.
199
+        if ($field['multiple'] >= 1) {
200 200
         // We name the element '_weight' to avoid clashing with column names
201 201
         // defined by field modules.
202 202
         $element['_weight'] = array(
203
-          '#type' => 'weight',
204
-          '#delta' => $max, // this 'delta' is the 'weight' element's property
205
-          '#default_value' => isset($items[$delta]['_weight']) ? $items[$delta]['_weight'] : $delta,
206
-          '#weight' => 100,
203
+            '#type' => 'weight',
204
+            '#delta' => $max, // this 'delta' is the 'weight' element's property
205
+            '#default_value' => isset($items[$delta]['_weight']) ? $items[$delta]['_weight'] : $delta,
206
+            '#weight' => 100,
207 207
         );
208
-      }
208
+        }
209 209
 
210
-      $form_element[$delta] = array_merge($element, $defaults);
210
+        $form_element[$delta] = array_merge($element, $defaults);
211
+    }
211 212
     }
212
-  }
213 213
 
214
-  // Add AHAH add more button, if not working with a programmed form.
215
-  if ($field['multiple'] == 1 && empty($form['#programmed'])) {
214
+    // Add AHAH add more button, if not working with a programmed form.
215
+    if ($field['multiple'] == 1 && empty($form['#programmed'])) {
216 216
     // Make sure the form is cached so ahah can work.
217 217
     $form['#cache'] = TRUE;
218 218
     $content_type = content_types($field['type_name']);
219 219
     $field_name_css = str_replace('_', '-', $field_name);
220 220
 
221 221
     $form_element[$field_name .'_add_more'] = array(
222
-      '#type' => 'submit',
223
-      '#name' => $field_name .'_add_more',
224
-      '#value' => t('Add another item'),
225
-      '#weight' => $field['widget']['weight'] + $max + 1,
226
-      // Submit callback for disabled JavaScript. drupal_get_form() might get
227
-      // the form from the cache, so we can't rely on content_form_alter()
228
-      // including this file. Therefore, call a proxy function to do this.
229
-      '#submit' => array('content_add_more_submit_proxy'),
230
-      '#ahah' => array(
222
+        '#type' => 'submit',
223
+        '#name' => $field_name .'_add_more',
224
+        '#value' => t('Add another item'),
225
+        '#weight' => $field['widget']['weight'] + $max + 1,
226
+        // Submit callback for disabled JavaScript. drupal_get_form() might get
227
+        // the form from the cache, so we can't rely on content_form_alter()
228
+        // including this file. Therefore, call a proxy function to do this.
229
+        '#submit' => array('content_add_more_submit_proxy'),
230
+        '#ahah' => array(
231 231
         'path' => 'content/js_add_more/'. $content_type['url_str'] .'/'. $field_name,
232 232
         'wrapper' => $field_name_css .'-items',
233 233
         'method' => 'replace',
234 234
         'effect' => 'fade',
235
-      ),
236
-      // When JS is disabled, the content_add_more_submit handler will find
237
-      // the relevant field using these entries.
238
-      '#field_name' => $field_name,
239
-      '#type_name' => $field['type_name'],
235
+        ),
236
+        // When JS is disabled, the content_add_more_submit handler will find
237
+        // the relevant field using these entries.
238
+        '#field_name' => $field_name,
239
+        '#type_name' => $field['type_name'],
240 240
     );
241 241
 
242 242
     // Add wrappers for the fields and 'more' button.
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
     $form_element['#suffix'] = '</div>';
245 245
     $form_element[$field_name .'_add_more']['#prefix'] = '<div class="content-add-more clear-block">';
246 246
     $form_element[$field_name .'_add_more']['#suffix'] = '</div>';
247
-  }
248
-  return $form_element;
247
+    }
248
+    return $form_element;
249 249
 }
250 250
 
251 251
 /**
@@ -254,127 +254,127 @@  discard block
 block discarded – undo
254 254
  * entire form is rebuilt during the page reload.
255 255
  */
256 256
 function content_add_more_submit($form, &$form_state) {
257
-  // Set the form to rebuild and run submit handlers.
258
-  node_form_submit_build_node($form, $form_state);
259
-  $field_name = $form_state['clicked_button']['#field_name'];
260
-  $type_name = $form_state['clicked_button']['#type_name'];
257
+    // Set the form to rebuild and run submit handlers.
258
+    node_form_submit_build_node($form, $form_state);
259
+    $field_name = $form_state['clicked_button']['#field_name'];
260
+    $type_name = $form_state['clicked_button']['#type_name'];
261 261
 
262
-  // Make the changes we want to the form state.
263
-  if ($form_state['values'][$field_name][$field_name .'_add_more']) {
262
+    // Make the changes we want to the form state.
263
+    if ($form_state['values'][$field_name][$field_name .'_add_more']) {
264 264
     $form_state['item_count'][$field_name] = count($form_state['values'][$field_name]);
265
-  }
265
+    }
266 266
 }
267 267
 
268 268
 /**
269 269
  * Menu callback for AHAH addition of new empty widgets.
270 270
  */
271 271
 function content_add_more_js($type_name_url, $field_name) {
272
-  $type = content_types($type_name_url);
273
-  $field = content_fields($field_name, $type['type']);
272
+    $type = content_types($type_name_url);
273
+    $field = content_fields($field_name, $type['type']);
274 274
 
275
-  if (($field['multiple'] != 1) || empty($_POST['form_build_id'])) {
275
+    if (($field['multiple'] != 1) || empty($_POST['form_build_id'])) {
276 276
     // Invalid request.
277 277
     drupal_json(array('data' => ''));
278 278
     exit;
279
-  }
279
+    }
280 280
 
281
-  // Retrieve the cached form.
282
-  $form_state = array('submitted' => FALSE);
283
-  $form_build_id = $_POST['form_build_id'];
284
-  $form = form_get_cache($form_build_id, $form_state);
285
-  if (!$form) {
281
+    // Retrieve the cached form.
282
+    $form_state = array('submitted' => FALSE);
283
+    $form_build_id = $_POST['form_build_id'];
284
+    $form = form_get_cache($form_build_id, $form_state);
285
+    if (!$form) {
286 286
     // Invalid form_build_id.
287 287
     drupal_json(array('data' => ''));
288 288
     exit;
289
-  }
290
-
291
-  // We don't simply return a new empty widget to append to existing ones, because
292
-  // - ahah.js won't simply let us add a new row to a table
293
-  // - attaching the 'draggable' behavior won't be easy
294
-  // So we resort to rebuilding the whole table of widgets including the existing ones,
295
-  // which makes us jump through a few hoops.
296
-
297
-  // The form that we get from the cache is unbuilt. We need to build it so that
298
-  // _value callbacks can be executed and $form_state['values'] populated.
299
-  // We only want to affect $form_state['values'], not the $form itself
300
-  // (built forms aren't supposed to enter the cache) nor the rest of $form_data,
301
-  // so we use copies of $form and $form_data.
302
-  $form_copy = $form;
303
-  $form_state_copy = $form_state;
304
-  $form_copy['#post'] = array();
305
-  form_builder($_POST['form_id'], $form_copy, $form_state_copy);
306
-  // Just grab the data we need.
307
-  $form_state['values'] = $form_state_copy['values'];
308
-  // Reset cached ids, so that they don't affect the actual form we output.
309
-  form_clean_id(NULL, TRUE);
310
-
311
-  // Sort the $form_state['values'] we just built *and* the incoming $_POST data
312
-  // according to d-n-d reordering.
313
-  unset($form_state['values'][$field_name][$field['field_name'] .'_add_more']);
314
-  foreach ($_POST[$field_name] as $delta => $item) {
289
+    }
290
+
291
+    // We don't simply return a new empty widget to append to existing ones, because
292
+    // - ahah.js won't simply let us add a new row to a table
293
+    // - attaching the 'draggable' behavior won't be easy
294
+    // So we resort to rebuilding the whole table of widgets including the existing ones,
295
+    // which makes us jump through a few hoops.
296
+
297
+    // The form that we get from the cache is unbuilt. We need to build it so that
298
+    // _value callbacks can be executed and $form_state['values'] populated.
299
+    // We only want to affect $form_state['values'], not the $form itself
300
+    // (built forms aren't supposed to enter the cache) nor the rest of $form_data,
301
+    // so we use copies of $form and $form_data.
302
+    $form_copy = $form;
303
+    $form_state_copy = $form_state;
304
+    $form_copy['#post'] = array();
305
+    form_builder($_POST['form_id'], $form_copy, $form_state_copy);
306
+    // Just grab the data we need.
307
+    $form_state['values'] = $form_state_copy['values'];
308
+    // Reset cached ids, so that they don't affect the actual form we output.
309
+    form_clean_id(NULL, TRUE);
310
+
311
+    // Sort the $form_state['values'] we just built *and* the incoming $_POST data
312
+    // according to d-n-d reordering.
313
+    unset($form_state['values'][$field_name][$field['field_name'] .'_add_more']);
314
+    foreach ($_POST[$field_name] as $delta => $item) {
315 315
     $form_state['values'][$field_name][$delta]['_weight'] = $item['_weight'];
316
-  }
317
-  $form_state['values'][$field_name] = _content_sort_items($field, $form_state['values'][$field_name]);
318
-  $_POST[$field_name] = _content_sort_items($field, $_POST[$field_name]);
319
-
320
-  // Build our new form element for the whole field, asking for one more element.
321
-  $form_state['item_count'] = array($field_name => count($_POST[$field_name]) + 1);
322
-  $form_element = content_field_form($form, $form_state, $field);
323
-  // Let other modules alter it.
324
-  // We pass an empty array as hook_form_alter's usual 'form_state' parameter,
325
-  // instead of $form_state (for reasons we may never remember).
326
-  // However, this argument is still expected to be passed by-reference
327
-  // (and PHP5.3 will throw an error if it isn't.) This leads to:
328
-  $data = &$form_element;
329
-  $empty_form_state = array();
330
-  $data['__drupal_alter_by_ref'] = array(&$empty_form_state);
331
-  drupal_alter('form', $data, 'content_add_more_js');
332
-
333
-  // Add the new element at the right place in the (original, unbuilt) form.
334
-  if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type['type'], $field_name))) {
316
+    }
317
+    $form_state['values'][$field_name] = _content_sort_items($field, $form_state['values'][$field_name]);
318
+    $_POST[$field_name] = _content_sort_items($field, $_POST[$field_name]);
319
+
320
+    // Build our new form element for the whole field, asking for one more element.
321
+    $form_state['item_count'] = array($field_name => count($_POST[$field_name]) + 1);
322
+    $form_element = content_field_form($form, $form_state, $field);
323
+    // Let other modules alter it.
324
+    // We pass an empty array as hook_form_alter's usual 'form_state' parameter,
325
+    // instead of $form_state (for reasons we may never remember).
326
+    // However, this argument is still expected to be passed by-reference
327
+    // (and PHP5.3 will throw an error if it isn't.) This leads to:
328
+    $data = &$form_element;
329
+    $empty_form_state = array();
330
+    $data['__drupal_alter_by_ref'] = array(&$empty_form_state);
331
+    drupal_alter('form', $data, 'content_add_more_js');
332
+
333
+    // Add the new element at the right place in the (original, unbuilt) form.
334
+    if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type['type'], $field_name))) {
335 335
     $form[$group_name][$field_name] = $form_element[$field_name];
336
-  }
337
-  else {
336
+    }
337
+    else {
338 338
     $form[$field_name] = $form_element[$field_name];
339
-  }
340
-
341
-  // Save the new definition of the form.
342
-  $form_state['values'] = array();
343
-  form_set_cache($form_build_id, $form, $form_state);
344
-
345
-  // Build the new form against the incoming $_POST values so that we can
346
-  // render the new element.
347
-  $delta = max(array_keys($_POST[$field_name])) + 1;
348
-  $_POST[$field_name][$delta]['_weight'] = $delta;
349
-  $form_state = array('submitted' => FALSE);
350
-  $form += array(
339
+    }
340
+
341
+    // Save the new definition of the form.
342
+    $form_state['values'] = array();
343
+    form_set_cache($form_build_id, $form, $form_state);
344
+
345
+    // Build the new form against the incoming $_POST values so that we can
346
+    // render the new element.
347
+    $delta = max(array_keys($_POST[$field_name])) + 1;
348
+    $_POST[$field_name][$delta]['_weight'] = $delta;
349
+    $form_state = array('submitted' => FALSE);
350
+    $form += array(
351 351
     '#post' => $_POST,
352 352
     '#programmed' => FALSE,
353
-  );
354
-  $form = form_builder($_POST['form_id'], $form, $form_state);
355
-
356
-  // Render the new output.
357
-  $field_form = (!empty($group_name)) ? $form[$group_name][$field_name] : $form[$field_name];
358
-  // We add a div around the new content to receive the ahah effect.
359
-  $field_form[$delta]['#prefix'] = '<div class="ahah-new-content">'. (isset($field_form[$delta]['#prefix']) ? $field_form[$delta]['#prefix'] : '');
360
-  $field_form[$delta]['#suffix'] = (isset($field_form[$delta]['#suffix']) ? $field_form[$delta]['#suffix'] : '') .'</div>';
361
-  // Prevent duplicate wrapper.
362
-  unset($field_form['#prefix'], $field_form['#suffix']);
363
-
364
-  // If a newly inserted widget contains AHAH behaviors, they normally won't
365
-  // work because AHAH doesn't know about those - it just attaches to the exact
366
-  // form elements that were initially specified in the Drupal.settings object.
367
-  // The new ones didn't exist then, so we need to update Drupal.settings
368
-  // by ourselves in order to let AHAH know about those new form elements.
369
-  $javascript = drupal_add_js(NULL, NULL);
370
-  $output_js = isset($javascript['setting']) ? '<script type="text/javascript">jQuery.extend(Drupal.settings, '. drupal_to_js(call_user_func_array('array_merge_recursive', $javascript['setting'])) .');</script>' : '';
371
-
372
-  $output = theme('status_messages') . drupal_render($field_form) . $output_js;
373
-
374
-  // Using drupal_json() breaks filefield's file upload, because the jQuery
375
-  // Form plugin handles file uploads in a way that is not compatible with
376
-  // 'text/javascript' response type.
377
-  $GLOBALS['devel_shutdown'] =  FALSE;
378
-  print drupal_to_js(array('status' => TRUE, 'data' => $output));
379
-  exit;
353
+    );
354
+    $form = form_builder($_POST['form_id'], $form, $form_state);
355
+
356
+    // Render the new output.
357
+    $field_form = (!empty($group_name)) ? $form[$group_name][$field_name] : $form[$field_name];
358
+    // We add a div around the new content to receive the ahah effect.
359
+    $field_form[$delta]['#prefix'] = '<div class="ahah-new-content">'. (isset($field_form[$delta]['#prefix']) ? $field_form[$delta]['#prefix'] : '');
360
+    $field_form[$delta]['#suffix'] = (isset($field_form[$delta]['#suffix']) ? $field_form[$delta]['#suffix'] : '') .'</div>';
361
+    // Prevent duplicate wrapper.
362
+    unset($field_form['#prefix'], $field_form['#suffix']);
363
+
364
+    // If a newly inserted widget contains AHAH behaviors, they normally won't
365
+    // work because AHAH doesn't know about those - it just attaches to the exact
366
+    // form elements that were initially specified in the Drupal.settings object.
367
+    // The new ones didn't exist then, so we need to update Drupal.settings
368
+    // by ourselves in order to let AHAH know about those new form elements.
369
+    $javascript = drupal_add_js(NULL, NULL);
370
+    $output_js = isset($javascript['setting']) ? '<script type="text/javascript">jQuery.extend(Drupal.settings, '. drupal_to_js(call_user_func_array('array_merge_recursive', $javascript['setting'])) .');</script>' : '';
371
+
372
+    $output = theme('status_messages') . drupal_render($field_form) . $output_js;
373
+
374
+    // Using drupal_json() breaks filefield's file upload, because the jQuery
375
+    // Form plugin handles file uploads in a way that is not compatible with
376
+    // 'text/javascript' response type.
377
+    $GLOBALS['devel_shutdown'] =  FALSE;
378
+    print drupal_to_js(array('status' => TRUE, 'data' => $output));
379
+    exit;
380 380
 }
Please login to merge, or discard this patch.
Switch Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -151,23 +151,23 @@
 block discarded – undo
151 151
   $field_name = $field['field_name'];
152 152
 
153 153
   switch ($field['multiple']) {
154
-    case 0:
155
-      $max = 0;
156
-      break;
157
-    case 1:
158
-      $filled_items = content_set_empty($field, $items);
159
-      $current_item_count = isset($form_state['item_count'][$field_name])
160
-                            ? $form_state['item_count'][$field_name]
161
-                            : count($items);
162
-      // We always want at least one empty icon for the user to fill in.
163
-      $max = ($current_item_count > count($filled_items))
164
-              ? $current_item_count - 1
165
-              : $current_item_count;
166
-
167
-      break;
168
-    default:
169
-      $max = $field['multiple'] - 1;
170
-      break;
154
+  case 0:
155
+    $max = 0;
156
+    break;
157
+  case 1:
158
+    $filled_items = content_set_empty($field, $items);
159
+    $current_item_count = isset($form_state['item_count'][$field_name])
160
+                          ? $form_state['item_count'][$field_name]
161
+                          : count($items);
162
+    // We always want at least one empty icon for the user to fill in.
163
+    $max = ($current_item_count > count($filled_items))
164
+            ? $current_item_count - 1
165
+            : $current_item_count;
166
+
167
+    break;
168
+  default:
169
+    $max = $field['multiple'] - 1;
170
+    break;
171 171
   }
172 172
 
173 173
   $title = check_plain(t($field['widget']['label']));
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
   $type = content_types($form['type']['#value']);
13 13
   foreach ($type['fields'] as $field_name => $field) {
14 14
     $form['#field_info'][$field['field_name']] = $field;
15
-    $form += (array) content_field_form($form, $form_state, $field);
15
+    $form += (array)content_field_form($form, $form_state, $field);
16 16
   }
17 17
   return $form;
18 18
 }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
   // TODO: is the "if (function_exists($function)) {" needed ?
48 48
   // defining the $function here makes it unclear where it is actually called
49
-  $function = $field['widget']['module'] .'_widget';
49
+  $function = $field['widget']['module'].'_widget';
50 50
   if (function_exists($function)) {
51 51
     // Prepare the values to be filled in the widget.
52 52
     // We look in the following places:
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     if (!empty($form_state['values'][$field['field_name']])) {
58 58
       $items = $form_state['values'][$field['field_name']];
59 59
       // If there was an AHAH add more button in this field, don't save it.
60
-      unset($items[$field['field_name'] .'_add_more']);
60
+      unset($items[$field['field_name'].'_add_more']);
61 61
     }
62 62
     elseif (!empty($node->$field['field_name'])) {
63 63
       $items = $node->$field['field_name'];
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         // it should provide a hook_default_value() function to call,
69 69
         // otherwise the content module's content_default_value() function
70 70
         // will be used.
71
-        $callback = content_callback('widget', 'default value', $field) == CONTENT_CALLBACK_CUSTOM ? $field['widget']['module'] .'_default_value' : 'content_default_value';
71
+        $callback = content_callback('widget', 'default value', $field) == CONTENT_CALLBACK_CUSTOM ? $field['widget']['module'].'_default_value' : 'content_default_value';
72 72
         if (function_exists($callback)) {
73 73
           $items = $callback($form, $form_state, $field, 0);
74 74
         }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     '#required' => $field['required'],
180 180
     '#description' => $description,
181 181
   );
182
-  $function = $field['widget']['module'] .'_widget';
182
+  $function = $field['widget']['module'].'_widget';
183 183
 
184 184
   for ($delta = 0; $delta <= $max; $delta++) {
185 185
     if ($element = $function($form, $form_state, $field, $items, $delta)) {
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
     $content_type = content_types($field['type_name']);
219 219
     $field_name_css = str_replace('_', '-', $field_name);
220 220
 
221
-    $form_element[$field_name .'_add_more'] = array(
221
+    $form_element[$field_name.'_add_more'] = array(
222 222
       '#type' => 'submit',
223
-      '#name' => $field_name .'_add_more',
223
+      '#name' => $field_name.'_add_more',
224 224
       '#value' => t('Add another item'),
225 225
       '#weight' => $field['widget']['weight'] + $max + 1,
226 226
       // Submit callback for disabled JavaScript. drupal_get_form() might get
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
       // including this file. Therefore, call a proxy function to do this.
229 229
       '#submit' => array('content_add_more_submit_proxy'),
230 230
       '#ahah' => array(
231
-        'path' => 'content/js_add_more/'. $content_type['url_str'] .'/'. $field_name,
232
-        'wrapper' => $field_name_css .'-items',
231
+        'path' => 'content/js_add_more/'.$content_type['url_str'].'/'.$field_name,
232
+        'wrapper' => $field_name_css.'-items',
233 233
         'method' => 'replace',
234 234
         'effect' => 'fade',
235 235
       ),
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
     );
241 241
 
242 242
     // Add wrappers for the fields and 'more' button.
243
-    $form_element['#prefix'] = '<div id="'. $field_name_css .'-items">';
243
+    $form_element['#prefix'] = '<div id="'.$field_name_css.'-items">';
244 244
     $form_element['#suffix'] = '</div>';
245
-    $form_element[$field_name .'_add_more']['#prefix'] = '<div class="content-add-more clear-block">';
246
-    $form_element[$field_name .'_add_more']['#suffix'] = '</div>';
245
+    $form_element[$field_name.'_add_more']['#prefix'] = '<div class="content-add-more clear-block">';
246
+    $form_element[$field_name.'_add_more']['#suffix'] = '</div>';
247 247
   }
248 248
   return $form_element;
249 249
 }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
   $type_name = $form_state['clicked_button']['#type_name'];
261 261
 
262 262
   // Make the changes we want to the form state.
263
-  if ($form_state['values'][$field_name][$field_name .'_add_more']) {
263
+  if ($form_state['values'][$field_name][$field_name.'_add_more']) {
264 264
     $form_state['item_count'][$field_name] = count($form_state['values'][$field_name]);
265 265
   }
266 266
 }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
   // Sort the $form_state['values'] we just built *and* the incoming $_POST data
312 312
   // according to d-n-d reordering.
313
-  unset($form_state['values'][$field_name][$field['field_name'] .'_add_more']);
313
+  unset($form_state['values'][$field_name][$field['field_name'].'_add_more']);
314 314
   foreach ($_POST[$field_name] as $delta => $item) {
315 315
     $form_state['values'][$field_name][$delta]['_weight'] = $item['_weight'];
316 316
   }
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
   // Render the new output.
357 357
   $field_form = (!empty($group_name)) ? $form[$group_name][$field_name] : $form[$field_name];
358 358
   // We add a div around the new content to receive the ahah effect.
359
-  $field_form[$delta]['#prefix'] = '<div class="ahah-new-content">'. (isset($field_form[$delta]['#prefix']) ? $field_form[$delta]['#prefix'] : '');
360
-  $field_form[$delta]['#suffix'] = (isset($field_form[$delta]['#suffix']) ? $field_form[$delta]['#suffix'] : '') .'</div>';
359
+  $field_form[$delta]['#prefix'] = '<div class="ahah-new-content">'.(isset($field_form[$delta]['#prefix']) ? $field_form[$delta]['#prefix'] : '');
360
+  $field_form[$delta]['#suffix'] = (isset($field_form[$delta]['#suffix']) ? $field_form[$delta]['#suffix'] : '').'</div>';
361 361
   // Prevent duplicate wrapper.
362 362
   unset($field_form['#prefix'], $field_form['#suffix']);
363 363
 
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
   // The new ones didn't exist then, so we need to update Drupal.settings
368 368
   // by ourselves in order to let AHAH know about those new form elements.
369 369
   $javascript = drupal_add_js(NULL, NULL);
370
-  $output_js = isset($javascript['setting']) ? '<script type="text/javascript">jQuery.extend(Drupal.settings, '. drupal_to_js(call_user_func_array('array_merge_recursive', $javascript['setting'])) .');</script>' : '';
370
+  $output_js = isset($javascript['setting']) ? '<script type="text/javascript">jQuery.extend(Drupal.settings, '.drupal_to_js(call_user_func_array('array_merge_recursive', $javascript['setting'])).');</script>' : '';
371 371
 
372
-  $output = theme('status_messages') . drupal_render($field_form) . $output_js;
372
+  $output = theme('status_messages').drupal_render($field_form).$output_js;
373 373
 
374 374
   // Using drupal_json() breaks filefield's file upload, because the jQuery
375 375
   // Form plugin handles file uploads in a way that is not compatible with
376 376
   // 'text/javascript' response type.
377
-  $GLOBALS['devel_shutdown'] =  FALSE;
377
+  $GLOBALS['devel_shutdown'] = FALSE;
378 378
   print drupal_to_js(array('status' => TRUE, 'data' => $output));
379 379
   exit;
380 380
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -58,11 +58,9 @@  discard block
 block discarded – undo
58 58
       $items = $form_state['values'][$field['field_name']];
59 59
       // If there was an AHAH add more button in this field, don't save it.
60 60
       unset($items[$field['field_name'] .'_add_more']);
61
-    }
62
-    elseif (!empty($node->$field['field_name'])) {
61
+    } elseif (!empty($node->$field['field_name'])) {
63 62
       $items = $node->$field['field_name'];
64
-    }
65
-    elseif (empty($node->nid)) {
63
+    } elseif (empty($node->nid)) {
66 64
       if (content_callback('widget', 'default value', $field) != CONTENT_CALLBACK_NONE) {
67 65
         // If a module wants to insert custom default values here,
68 66
         // it should provide a hook_default_value() function to call,
@@ -115,8 +113,7 @@  discard block
 block discarded – undo
115 113
         // about how the field is structured, just merge in the returned value.
116 114
         if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_CORE) {
117 115
           $form_element[$delta] = array_merge($element, $defaults);
118
-        }
119
-        else {
116
+        } else {
120 117
           $form_element = array_merge($element, $defaults);
121 118
         }
122 119
       }
@@ -333,8 +330,7 @@  discard block
 block discarded – undo
333 330
   // Add the new element at the right place in the (original, unbuilt) form.
334 331
   if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type['type'], $field_name))) {
335 332
     $form[$group_name][$field_name] = $form_element[$field_name];
336
-  }
337
-  else {
333
+  } else {
338 334
     $form[$field_name] = $form_element[$field_name];
339 335
   }
340 336
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
  *   use to get only a specific delta value of a multiple value field, otherwise
36 36
  *   function will return the entire $field form element.
37 37
  */
38
-function content_field_form(&$form, &$form_state, $field, $get_delta = NULL) {
39
-  $form['#cache'] = FALSE;
38
+function content_field_form(&$form, &$form_state, $field, $get_delta = null) {
39
+  $form['#cache'] = false;
40 40
   $node = $form['#node'];
41 41
   $addition = array();
42 42
   $form_element = array();
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     // See if access to this form element is restricted,
79 79
     // if so, skip widget processing and just set the value.
80
-    $access = content_access('edit', $field, NULL, $node);
80
+    $access = content_access('edit', $field, null, $node);
81 81
     if (!$access) {
82 82
       $addition[$field_name] = array(
83 83
         '#access' => $access,
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $title = check_plain(t($field['widget']['label']));
102 102
         $description = content_filter_xss(t($field['widget']['description']));
103 103
         $defaults = array(
104
-          '#required' => $get_delta > 0 ? FALSE : $field['required'],
104
+          '#required' => $get_delta > 0 ? false : $field['required'],
105 105
           '#columns'  => array_keys($field['columns']),
106 106
           '#title' => $title,
107 107
           '#description' => $description,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     if ($form_element) {
128 128
       $defaults = array(
129 129
         '#field_name' => $field['field_name'],
130
-        '#tree' => TRUE,
130
+        '#tree' => true,
131 131
         '#weight' => $field['widget']['weight'],
132 132
         '#access' => $access,
133 133
         // TODO: what's the need for #count ? does not seem to be used anywhere ?
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
   // Add AHAH add more button, if not working with a programmed form.
215 215
   if ($field['multiple'] == 1 && empty($form['#programmed'])) {
216 216
     // Make sure the form is cached so ahah can work.
217
-    $form['#cache'] = TRUE;
217
+    $form['#cache'] = true;
218 218
     $content_type = content_types($field['type_name']);
219 219
     $field_name_css = str_replace('_', '-', $field_name);
220 220
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
   }
280 280
 
281 281
   // Retrieve the cached form.
282
-  $form_state = array('submitted' => FALSE);
282
+  $form_state = array('submitted' => false);
283 283
   $form_build_id = $_POST['form_build_id'];
284 284
   $form = form_get_cache($form_build_id, $form_state);
285 285
   if (!$form) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
   // Just grab the data we need.
307 307
   $form_state['values'] = $form_state_copy['values'];
308 308
   // Reset cached ids, so that they don't affect the actual form we output.
309
-  form_clean_id(NULL, TRUE);
309
+  form_clean_id(null, true);
310 310
 
311 311
   // Sort the $form_state['values'] we just built *and* the incoming $_POST data
312 312
   // according to d-n-d reordering.
@@ -346,10 +346,10 @@  discard block
 block discarded – undo
346 346
   // render the new element.
347 347
   $delta = max(array_keys($_POST[$field_name])) + 1;
348 348
   $_POST[$field_name][$delta]['_weight'] = $delta;
349
-  $form_state = array('submitted' => FALSE);
349
+  $form_state = array('submitted' => false);
350 350
   $form += array(
351 351
     '#post' => $_POST,
352
-    '#programmed' => FALSE,
352
+    '#programmed' => false,
353 353
   );
354 354
   $form = form_builder($_POST['form_id'], $form, $form_state);
355 355
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
   // form elements that were initially specified in the Drupal.settings object.
367 367
   // The new ones didn't exist then, so we need to update Drupal.settings
368 368
   // by ourselves in order to let AHAH know about those new form elements.
369
-  $javascript = drupal_add_js(NULL, NULL);
369
+  $javascript = drupal_add_js(null, null);
370 370
   $output_js = isset($javascript['setting']) ? '<script type="text/javascript">jQuery.extend(Drupal.settings, '. drupal_to_js(call_user_func_array('array_merge_recursive', $javascript['setting'])) .');</script>' : '';
371 371
 
372 372
   $output = theme('status_messages') . drupal_render($field_form) . $output_js;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
   // Using drupal_json() breaks filefield's file upload, because the jQuery
375 375
   // Form plugin handles file uploads in a way that is not compatible with
376 376
   // 'text/javascript' response type.
377
-  $GLOBALS['devel_shutdown'] =  FALSE;
378
-  print drupal_to_js(array('status' => TRUE, 'data' => $output));
377
+  $GLOBALS['devel_shutdown'] =  false;
378
+  print drupal_to_js(array('status' => true, 'data' => $output));
379 379
   exit;
380 380
 }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/cck/includes/content.devel.inc 4 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -19,48 +19,48 @@  discard block
 block discarded – undo
19 19
  * information in each of its CCK fields.
20 20
  **/
21 21
 function content_generate_fields(&$node, $field) {
22
-  $type_name = $node->type;
23
-  $type = content_types($type_name);
24
-  $field_types = _content_field_types();
22
+    $type_name = $node->type;
23
+    $type = content_types($type_name);
24
+    $field_types = _content_field_types();
25 25
 
26
-  if (!empty($type['fields'])) {
26
+    if (!empty($type['fields'])) {
27 27
     foreach ($type['fields'] as $field) {
28
-      $node_field = array();
29
-      // If module handles own multiples, then only call its hook once.
30
-      if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
28
+        $node_field = array();
29
+        // If module handles own multiples, then only call its hook once.
30
+        if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
31 31
         $max = 0;
32
-      }
33
-      else {
32
+        }
33
+        else {
34 34
         switch ($field['multiple']) {
35
-          case 0:
35
+            case 0:
36 36
             $max = 0;
37 37
             break;
38
-          case 1:
38
+            case 1:
39 39
             $max = rand(0, 3); //just an arbitrary number for 'unlimited'
40 40
             break;
41
-          default:
41
+            default:
42 42
             $max = $field['multiple'];
43 43
             break;
44 44
         }
45
-      }
46
-      for ($i = 0; $i <= $max; $i++) {
45
+        }
46
+        for ($i = 0; $i <= $max; $i++) {
47 47
         $module = $field_types[$field['type']]['module'];
48 48
         $function = $module .'_content_generate';
49 49
         if (function_exists($function)) {
50
-          $result = $function($node, $field); // $items, $teaser, $page
51
-          if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
50
+            $result = $function($node, $field); // $items, $teaser, $page
51
+            if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
52 52
             // Fields that handle their own multiples will add their own deltas.
53 53
             $node_field = $result;
54
-          }
55
-          else {
54
+            }
55
+            else {
56 56
             // When multiples are handled by the content module, add a delta for each result.
57 57
             $node_field[$i] = $result;
58
-          }
58
+            }
59 59
         }
60
-      }
61
-      $node->{$field['field_name']} = $node_field;
60
+        }
61
+        $node->{$field['field_name']} = $node_field;
62
+    }
62 63
     }
63
-  }
64 64
 }
65 65
 
66 66
 /**
@@ -70,149 +70,149 @@  discard block
 block discarded – undo
70 70
  * a random number of times and compile the results into a node array.
71 71
  */
72 72
 function content_devel_multiple($function, $node, $field) {
73
-  $node_field = array();
74
-  if (function_exists($function)) {
73
+    $node_field = array();
74
+    if (function_exists($function)) {
75 75
     switch ($field['multiple']) {
76
-      case 0:
76
+        case 0:
77 77
         $max = 0;
78 78
         break;
79
-      case 1:
79
+        case 1:
80 80
         $max = rand(0, 3); //just an arbitrary number for 'unlimited'
81 81
         break;
82
-      default:
82
+        default:
83 83
         $max = $field['multiple'];
84 84
         break;
85 85
     }
86 86
     for ($i = 0; $i <= $max; $i++) {
87
-      $node_field[$i] = $function($node, $field);
87
+        $node_field[$i] = $function($node, $field);
88
+    }
88 89
     }
89
-  }
90
-  return $node_field;
90
+    return $node_field;
91 91
 }
92 92
 
93 93
 if (module_exists('text')) {
94
-  function text_content_generate($node, $field) {
94
+    function text_content_generate($node, $field) {
95 95
     if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
96
-      return content_devel_multiple('_text_content_generate', $node, $field);
96
+        return content_devel_multiple('_text_content_generate', $node, $field);
97 97
     }
98 98
     else {
99
-      return _text_content_generate($node, $field);
99
+        return _text_content_generate($node, $field);
100
+    }
100 101
     }
101
-  }
102 102
 
103
-  function _text_content_generate($node, $field) {
103
+    function _text_content_generate($node, $field) {
104 104
     $node_field = array();
105 105
     if ($field['widget']['type'] == 'text_textarea') {
106
-      $format = $field['text_processing'] ? rand(0, 3) : 0;
107
-      $node_field['value'] = devel_create_content($format);
108
-      $node_field['format'] = $format;
106
+        $format = $field['text_processing'] ? rand(0, 3) : 0;
107
+        $node_field['value'] = devel_create_content($format);
108
+        $node_field['format'] = $format;
109 109
     }
110 110
     else {
111
-      $allowed_values = content_allowed_values($field);
112
-      if (!empty($allowed_values)) {
111
+        $allowed_values = content_allowed_values($field);
112
+        if (!empty($allowed_values)) {
113 113
         // Just pick one of the specified allowed values.
114 114
         $node_field['value'] = array_rand($allowed_values);
115
-      }
116
-      else {
115
+        }
116
+        else {
117 117
         // Generate a value that respects max_length.
118 118
         if (empty($field['max_length'])) {
119
-          $field['max_length'] = 12;
119
+            $field['max_length'] = 12;
120 120
         }
121 121
         $node_field['value'] = user_password($field['max_length']);
122
-      }
122
+        }
123 123
     }
124 124
     return $node_field;
125
-  }
125
+    }
126 126
 }
127 127
 
128 128
 if (module_exists('number')) {
129
-  function number_content_generate($node, $field) {
129
+    function number_content_generate($node, $field) {
130 130
     if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
131
-      return content_devel_multiple('_number_content_generate', $node, $field);
131
+        return content_devel_multiple('_number_content_generate', $node, $field);
132 132
     }
133 133
     else {
134
-      return _number_content_generate($node, $field);
134
+        return _number_content_generate($node, $field);
135
+    }
135 136
     }
136
-  }
137 137
 
138
-  function _number_content_generate($node, $field) {
138
+    function _number_content_generate($node, $field) {
139 139
     $node_field = array();
140 140
     $allowed_values = content_allowed_values($field);
141 141
     if (!empty($allowed_values)) {
142
-      // Just pick one of the specified allowed values.
143
-      $node_field['value'] = array_rand($allowed_values);
142
+        // Just pick one of the specified allowed values.
143
+        $node_field['value'] = array_rand($allowed_values);
144 144
     }
145 145
     else {
146
-      $min = is_numeric($field['min']) ? $field['min'] : 0;
147
-      switch ($field['type']) {
146
+        $min = is_numeric($field['min']) ? $field['min'] : 0;
147
+        switch ($field['type']) {
148 148
         case 'number_integer':
149 149
           $max = is_numeric($field['max']) ? $field['max'] : 10000;
150
-          $decimal = 0;
151
-          $scale = 0;
152
-          break;
150
+            $decimal = 0;
151
+            $scale = 0;
152
+            break;
153 153
 
154 154
         case 'number_decimal':
155 155
           $precision = is_numeric($field['precision']) ? $field['precision'] : 10;
156
-          $scale = is_numeric($field['scale']) ? $field['scale'] : 2;
157
-          $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
158
-          $decimal = rand(0, (10 * $scale)) / 100;
159
-          break;
156
+            $scale = is_numeric($field['scale']) ? $field['scale'] : 2;
157
+            $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
158
+            $decimal = rand(0, (10 * $scale)) / 100;
159
+            break;
160 160
 
161 161
         case 'number_float':
162 162
           $precision = rand(10, 32);
163
-          $scale = rand(0, 2);
164
-          $decimal = rand(0, (10 * $scale)) / 100;
165
-          $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
166
-          break;
167
-      }
168
-      $node_field['value'] = round((rand($min, $max) + $decimal), $scale);
163
+            $scale = rand(0, 2);
164
+            $decimal = rand(0, (10 * $scale)) / 100;
165
+            $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
166
+            break;
167
+        }
168
+        $node_field['value'] = round((rand($min, $max) + $decimal), $scale);
169 169
     }
170 170
     return $node_field;
171
-  }
171
+    }
172 172
 }
173 173
 
174 174
 if (module_exists('nodereference')) {
175
-  function nodereference_content_generate($node, $field) {
175
+    function nodereference_content_generate($node, $field) {
176 176
     if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
177
-      return content_devel_multiple('_nodereference_content_generate', $node, $field);
177
+        return content_devel_multiple('_nodereference_content_generate', $node, $field);
178 178
     }
179 179
     else {
180
-      return _nodereference_content_generate($node, $field);
180
+        return _nodereference_content_generate($node, $field);
181
+    }
181 182
     }
182
-  }
183 183
 
184
-  function _nodereference_content_generate($node, $field) {
184
+    function _nodereference_content_generate($node, $field) {
185 185
     $node_field = array();
186 186
     $allowed_values = nodereference_allowed_values($field);
187 187
     unset($allowed_values[0]);
188 188
     if (!empty($allowed_values)) {
189
-      // Just pick one of the specified allowed values.
190
-      $node_field['nid'] = array_rand($allowed_values);
189
+        // Just pick one of the specified allowed values.
190
+        $node_field['nid'] = array_rand($allowed_values);
191 191
     }
192 192
     return $node_field;
193
-  }
193
+    }
194 194
 }
195 195
 
196 196
 if (module_exists('userreference')) {
197
-  function userreference_content_generate($node, $field) {
197
+    function userreference_content_generate($node, $field) {
198 198
     if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
199
-      return content_devel_multiple('_userreference_content_generate', $node, $field);
199
+        return content_devel_multiple('_userreference_content_generate', $node, $field);
200 200
     }
201 201
     else {
202
-      return _userreference_content_generate($node, $field);
202
+        return _userreference_content_generate($node, $field);
203
+    }
203 204
     }
204
-  }
205 205
 
206
-  function _userreference_content_generate($node, $field) {
206
+    function _userreference_content_generate($node, $field) {
207 207
     $node_field = array();
208 208
     $allowed_values = userreference_allowed_values($field);
209 209
     if (isset($allowed_values['none'])) {
210
-      unset($allowed_values['none']);
210
+        unset($allowed_values['none']);
211 211
     }
212 212
     if (!empty($allowed_values)) {
213
-      // Just pick one of the specified allowed values.
214
-      $node_field['uid'] = array_rand($allowed_values);
213
+        // Just pick one of the specified allowed values.
214
+        $node_field['uid'] = array_rand($allowed_values);
215 215
     }
216 216
     return $node_field;
217
-  }
217
+    }
218 218
 }
219 219
\ No newline at end of file
Please login to merge, or discard this patch.
Switch Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
       }
33 33
       else {
34 34
         switch ($field['multiple']) {
35
-          case 0:
36
-            $max = 0;
37
-            break;
38
-          case 1:
39
-            $max = rand(0, 3); //just an arbitrary number for 'unlimited'
40
-            break;
41
-          default:
42
-            $max = $field['multiple'];
43
-            break;
35
+        case 0:
36
+          $max = 0;
37
+          break;
38
+        case 1:
39
+          $max = rand(0, 3); //just an arbitrary number for 'unlimited'
40
+          break;
41
+        default:
42
+          $max = $field['multiple'];
43
+          break;
44 44
         }
45 45
       }
46 46
       for ($i = 0; $i <= $max; $i++) {
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
   $node_field = array();
74 74
   if (function_exists($function)) {
75 75
     switch ($field['multiple']) {
76
-      case 0:
77
-        $max = 0;
78
-        break;
79
-      case 1:
80
-        $max = rand(0, 3); //just an arbitrary number for 'unlimited'
81
-        break;
82
-      default:
83
-        $max = $field['multiple'];
84
-        break;
76
+    case 0:
77
+      $max = 0;
78
+      break;
79
+    case 1:
80
+      $max = rand(0, 3); //just an arbitrary number for 'unlimited'
81
+      break;
82
+    default:
83
+      $max = $field['multiple'];
84
+      break;
85 85
     }
86 86
     for ($i = 0; $i <= $max; $i++) {
87 87
       $node_field[$i] = $function($node, $field);
@@ -145,25 +145,25 @@  discard block
 block discarded – undo
145 145
     else {
146 146
       $min = is_numeric($field['min']) ? $field['min'] : 0;
147 147
       switch ($field['type']) {
148
-        case 'number_integer':
149
-          $max = is_numeric($field['max']) ? $field['max'] : 10000;
150
-          $decimal = 0;
151
-          $scale = 0;
152
-          break;
148
+      case 'number_integer':
149
+        $max = is_numeric($field['max']) ? $field['max'] : 10000;
150
+        $decimal = 0;
151
+        $scale = 0;
152
+        break;
153 153
 
154
-        case 'number_decimal':
155
-          $precision = is_numeric($field['precision']) ? $field['precision'] : 10;
156
-          $scale = is_numeric($field['scale']) ? $field['scale'] : 2;
157
-          $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
158
-          $decimal = rand(0, (10 * $scale)) / 100;
159
-          break;
154
+      case 'number_decimal':
155
+        $precision = is_numeric($field['precision']) ? $field['precision'] : 10;
156
+        $scale = is_numeric($field['scale']) ? $field['scale'] : 2;
157
+        $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
158
+        $decimal = rand(0, (10 * $scale)) / 100;
159
+        break;
160 160
 
161
-        case 'number_float':
162
-          $precision = rand(10, 32);
163
-          $scale = rand(0, 2);
164
-          $decimal = rand(0, (10 * $scale)) / 100;
165
-          $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
166
-          break;
161
+      case 'number_float':
162
+        $precision = rand(10, 32);
163
+        $scale = rand(0, 2);
164
+        $decimal = rand(0, (10 * $scale)) / 100;
165
+        $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
166
+        break;
167 167
       }
168 168
       $node_field['value'] = round((rand($min, $max) + $decimal), $scale);
169 169
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
       }
46 46
       for ($i = 0; $i <= $max; $i++) {
47 47
         $module = $field_types[$field['type']]['module'];
48
-        $function = $module .'_content_generate';
48
+        $function = $module.'_content_generate';
49 49
         if (function_exists($function)) {
50 50
           $result = $function($node, $field); // $items, $teaser, $page
51 51
           if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
           $precision = is_numeric($field['precision']) ? $field['precision'] : 10;
156 156
           $scale = is_numeric($field['scale']) ? $field['scale'] : 2;
157 157
           $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
158
-          $decimal = rand(0, (10 * $scale)) / 100;
158
+          $decimal = rand(0, (10*$scale))/100;
159 159
           break;
160 160
 
161 161
         case 'number_float':
162 162
           $precision = rand(10, 32);
163 163
           $scale = rand(0, 2);
164
-          $decimal = rand(0, (10 * $scale)) / 100;
164
+          $decimal = rand(0, (10*$scale))/100;
165 165
           $max = is_numeric($field['max']) ? $field['max'] : pow(10, ($precision - $scale));
166 166
           break;
167 167
       }
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
       // If module handles own multiples, then only call its hook once.
30 30
       if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
31 31
         $max = 0;
32
-      }
33
-      else {
32
+      } else {
34 33
         switch ($field['multiple']) {
35 34
           case 0:
36 35
             $max = 0;
@@ -51,8 +50,7 @@  discard block
 block discarded – undo
51 50
           if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
52 51
             // Fields that handle their own multiples will add their own deltas.
53 52
             $node_field = $result;
54
-          }
55
-          else {
53
+          } else {
56 54
             // When multiples are handled by the content module, add a delta for each result.
57 55
             $node_field[$i] = $result;
58 56
           }
@@ -94,8 +92,7 @@  discard block
 block discarded – undo
94 92
   function text_content_generate($node, $field) {
95 93
     if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
96 94
       return content_devel_multiple('_text_content_generate', $node, $field);
97
-    }
98
-    else {
95
+    } else {
99 96
       return _text_content_generate($node, $field);
100 97
     }
101 98
   }
@@ -106,14 +103,12 @@  discard block
 block discarded – undo
106 103
       $format = $field['text_processing'] ? rand(0, 3) : 0;
107 104
       $node_field['value'] = devel_create_content($format);
108 105
       $node_field['format'] = $format;
109
-    }
110
-    else {
106
+    } else {
111 107
       $allowed_values = content_allowed_values($field);
112 108
       if (!empty($allowed_values)) {
113 109
         // Just pick one of the specified allowed values.
114 110
         $node_field['value'] = array_rand($allowed_values);
115
-      }
116
-      else {
111
+      } else {
117 112
         // Generate a value that respects max_length.
118 113
         if (empty($field['max_length'])) {
119 114
           $field['max_length'] = 12;
@@ -129,8 +124,7 @@  discard block
 block discarded – undo
129 124
   function number_content_generate($node, $field) {
130 125
     if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
131 126
       return content_devel_multiple('_number_content_generate', $node, $field);
132
-    }
133
-    else {
127
+    } else {
134 128
       return _number_content_generate($node, $field);
135 129
     }
136 130
   }
@@ -141,8 +135,7 @@  discard block
 block discarded – undo
141 135
     if (!empty($allowed_values)) {
142 136
       // Just pick one of the specified allowed values.
143 137
       $node_field['value'] = array_rand($allowed_values);
144
-    }
145
-    else {
138
+    } else {
146 139
       $min = is_numeric($field['min']) ? $field['min'] : 0;
147 140
       switch ($field['type']) {
148 141
         case 'number_integer':
@@ -175,8 +168,7 @@  discard block
 block discarded – undo
175 168
   function nodereference_content_generate($node, $field) {
176 169
     if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
177 170
       return content_devel_multiple('_nodereference_content_generate', $node, $field);
178
-    }
179
-    else {
171
+    } else {
180 172
       return _nodereference_content_generate($node, $field);
181 173
     }
182 174
   }
@@ -197,8 +189,7 @@  discard block
 block discarded – undo
197 189
   function userreference_content_generate($node, $field) {
198 190
     if (content_handle('widget', 'multiple values', $field) == CONTENT_HANDLE_MODULE) {
199 191
       return content_devel_multiple('_userreference_content_generate', $node, $field);
200
-    }
201
-    else {
192
+    } else {
202 193
       return _userreference_content_generate($node, $field);
203 194
     }
204 195
   }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/cck/includes/content.token.inc 3 patches
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -7,181 +7,181 @@
 block discarded – undo
7 7
  * (on behalf of token.module)
8 8
  */
9 9
 function token_content_build_modes() {
10
-  return array(
10
+    return array(
11 11
     'token' => array(
12
-      'title' => t('Token'),
13
-      'build modes' => array(
12
+        'title' => t('Token'),
13
+        'build modes' => array(
14 14
         'token' => array(
15
-          'title' => t('Token'),
16
-          'views style' => FALSE,
15
+            'title' => t('Token'),
16
+            'views style' => FALSE,
17
+        ),
17 18
         ),
18
-      ),
19 19
     ),
20
-  );
20
+    );
21 21
 }
22 22
 
23 23
 // Two helper functions that generate appropriate tokens for CCK-added fields.
24 24
 function content_token_values($type, $object = NULL, $options = array()) {
25
-  $tokens = array();
26
-  if ($type == 'node') {
25
+    $tokens = array();
26
+    if ($type == 'node') {
27 27
     // Prevent against invalid 'nodes' built by broken 3rd party code.
28 28
     if (isset($object->type)) {
29
-      // Let PHP free the $node object when we are done. Working directly on the
30
-      // incoming $object causes memory leak issues on long-running scripts such
31
-      // as migrations. See http://drupal.org/node/736440.
32
-      $node = drupal_clone($object);
33
-      $content_type = content_types($node->type);
34
-      $node->build_mode = 'token';
35
-      $node->content = array();
36
-      content_view($node);
37
-      // The formatted values will only be known after the content has been rendered.
38
-      drupal_render($node->content);
39
-      content_alter($node);
40
-
41
-      $field_types = _content_field_types();
42
-      foreach ($content_type['fields'] as $field_name => $field) {
29
+        // Let PHP free the $node object when we are done. Working directly on the
30
+        // incoming $object causes memory leak issues on long-running scripts such
31
+        // as migrations. See http://drupal.org/node/736440.
32
+        $node = drupal_clone($object);
33
+        $content_type = content_types($node->type);
34
+        $node->build_mode = 'token';
35
+        $node->content = array();
36
+        content_view($node);
37
+        // The formatted values will only be known after the content has been rendered.
38
+        drupal_render($node->content);
39
+        content_alter($node);
40
+
41
+        $field_types = _content_field_types();
42
+        foreach ($content_type['fields'] as $field_name => $field) {
43 43
         $items = isset($node->{$field_name}) ? $node->{$field_name} : array();
44 44
         $function = $field_types[$field['type']]['module'] . '_token_values';
45 45
         if (!empty($items) && function_exists($function)) {
46
-          $token_values = (array) $function('field', $items, $options);
47
-          foreach ($token_values as $token => $value) {
46
+            $token_values = (array) $function('field', $items, $options);
47
+            foreach ($token_values as $token => $value) {
48 48
             $tokens[$field_name .'-'. $token] = $value;
49
-          }
49
+            }
50
+        }
50 51
         }
51
-      }
52 52
     }
53
-  }
54
-  return $tokens;
53
+    }
54
+    return $tokens;
55 55
 }
56 56
 
57 57
 function content_token_list($type = 'all') {
58
-  if ($type == 'node' || $type == 'all') {
58
+    if ($type == 'node' || $type == 'all') {
59 59
     $list = array();
60 60
     $field_types = _content_field_types();
61 61
 
62 62
     foreach (content_fields() as $field) {
63
-      $sub_list = array();
64
-      $function = $field_types[$field['type']]['module'] . '_token_list';
65
-      if (function_exists($function)) {
63
+        $sub_list = array();
64
+        $function = $field_types[$field['type']]['module'] . '_token_list';
65
+        if (function_exists($function)) {
66 66
         $sub_list = $function('field');
67 67
         foreach ($sub_list as $category => $token_list) {
68
-          foreach ($token_list as $token => $description) {
68
+            foreach ($token_list as $token => $description) {
69 69
             $list['CCK '. $category][$field['field_name'] .'-'. $token] = $description;
70
-          }
70
+            }
71
+        }
71 72
         }
72
-      }
73 73
     }
74 74
 
75 75
     return $list;
76
-  }
76
+    }
77 77
 }
78 78
 
79 79
 if (module_exists('nodereference')) {
80
-  function nodereference_token_list($type = 'all') {
80
+    function nodereference_token_list($type = 'all') {
81 81
     if ($type == 'field' || $type == 'all') {
82
-      $tokens = array();
82
+        $tokens = array();
83 83
 
84
-      $tokens['node reference']['nid']   = t('Referenced node ID');
85
-      $tokens['node reference']['title'] = t('Referenced node title');
86
-      $tokens['node reference']['title-raw'] = t('Referenced node unfiltered title. WARNING - raw user input.');
87
-      $tokens['node reference']['link']  = t("Formatted html link to the referenced node.");
88
-      $tokens['node reference']['path']  = t("Relative path alias to the referenced node.");
89
-      $tokens['node reference']['url']  = t("Absolute path alias to the referenced node.");
84
+        $tokens['node reference']['nid']   = t('Referenced node ID');
85
+        $tokens['node reference']['title'] = t('Referenced node title');
86
+        $tokens['node reference']['title-raw'] = t('Referenced node unfiltered title. WARNING - raw user input.');
87
+        $tokens['node reference']['link']  = t("Formatted html link to the referenced node.");
88
+        $tokens['node reference']['path']  = t("Relative path alias to the referenced node.");
89
+        $tokens['node reference']['url']  = t("Absolute path alias to the referenced node.");
90 90
 
91
-      return $tokens;
91
+        return $tokens;
92
+    }
92 93
     }
93
-  }
94 94
 
95
-  function nodereference_token_values($type, $object = NULL, $options = array()) {
95
+    function nodereference_token_values($type, $object = NULL, $options = array()) {
96 96
     if ($type == 'field') {
97
-      $item = $object[0];
97
+        $item = $object[0];
98 98
 
99
-      $title = is_numeric($item['nid']) ? _nodereference_titles($item['nid']) : '';
100
-      $tokens['nid']   = $item['nid'];
101
-      $tokens['title'] = $title ? check_plain($title) : '';
102
-      $tokens['title-raw'] = $title;
103
-      $tokens['link']  = isset($item['view']) ? $item['view'] : '';
104
-      $tokens['path'] = is_numeric($item['nid']) ? url('node/' . $item['nid']) : '';
105
-      $tokens['url'] = is_numeric($item['nid']) ? url('node/' . $item['nid'], array('absolute' => TRUE)) : '';
99
+        $title = is_numeric($item['nid']) ? _nodereference_titles($item['nid']) : '';
100
+        $tokens['nid']   = $item['nid'];
101
+        $tokens['title'] = $title ? check_plain($title) : '';
102
+        $tokens['title-raw'] = $title;
103
+        $tokens['link']  = isset($item['view']) ? $item['view'] : '';
104
+        $tokens['path'] = is_numeric($item['nid']) ? url('node/' . $item['nid']) : '';
105
+        $tokens['url'] = is_numeric($item['nid']) ? url('node/' . $item['nid'], array('absolute' => TRUE)) : '';
106 106
 
107
-      return $tokens;
107
+        return $tokens;
108
+    }
108 109
     }
109
-  }
110 110
 }
111 111
 
112 112
 if (module_exists('number')) {
113
-  function number_token_list($type = 'all') {
113
+    function number_token_list($type = 'all') {
114 114
     if ($type == 'field' || $type == 'all') {
115
-      $tokens = array();
115
+        $tokens = array();
116 116
 
117
-      $tokens['number']['raw']       = t('Raw number value');
118
-      $tokens['number']['formatted'] = t('Formatted number value');
117
+        $tokens['number']['raw']       = t('Raw number value');
118
+        $tokens['number']['formatted'] = t('Formatted number value');
119 119
 
120
-      return $tokens;
120
+        return $tokens;
121
+    }
121 122
     }
122
-  }
123 123
 
124
-  function number_token_values($type, $object = NULL, $options = array()) {
124
+    function number_token_values($type, $object = NULL, $options = array()) {
125 125
     if ($type == 'field') {
126
-      $item = $object[0];
126
+        $item = $object[0];
127 127
 
128
-      $tokens['raw']       = $item['value'];
129
-      $tokens['formatted'] = isset($item['view']) ? $item['view'] : '';
128
+        $tokens['raw']       = $item['value'];
129
+        $tokens['formatted'] = isset($item['view']) ? $item['view'] : '';
130 130
 
131
-      return $tokens;
131
+        return $tokens;
132
+    }
132 133
     }
133
-  }
134 134
 }
135 135
 
136 136
 if (module_exists('text')) {
137
-  function text_token_list($type = 'all') {
137
+    function text_token_list($type = 'all') {
138 138
     if ($type == 'field' || $type == 'all') {
139
-      $tokens = array();
139
+        $tokens = array();
140 140
 
141
-      $tokens['text']['raw']       = t('Raw, unfiltered text');
142
-      $tokens['text']['formatted'] = t('Formatted and filtered text');
141
+        $tokens['text']['raw']       = t('Raw, unfiltered text');
142
+        $tokens['text']['formatted'] = t('Formatted and filtered text');
143 143
 
144
-      return $tokens;
144
+        return $tokens;
145
+    }
145 146
     }
146
-  }
147 147
 
148
-  function text_token_values($type, $object = NULL, $options = array()) {
148
+    function text_token_values($type, $object = NULL, $options = array()) {
149 149
     if ($type == 'field') {
150
-      $item = $object[0];
150
+        $item = $object[0];
151 151
 
152
-      $tokens['raw']  = $item['value'];
153
-      $tokens['formatted'] = isset($item['view']) ? $item['view'] : '';
154
-      return $tokens;
152
+        $tokens['raw']  = $item['value'];
153
+        $tokens['formatted'] = isset($item['view']) ? $item['view'] : '';
154
+        return $tokens;
155
+    }
155 156
     }
156
-  }
157 157
 }
158 158
 
159 159
 if (module_exists('userreference')) {
160
-  function userreference_token_list($type = 'all') {
160
+    function userreference_token_list($type = 'all') {
161 161
     if ($type == 'field' || $type == 'all') {
162
-      $tokens = array();
162
+        $tokens = array();
163 163
 
164
-      $tokens['user reference']['uid']   = t('Referenced user ID');
165
-      $tokens['user reference']['name']  = t('Referenced user name');
166
-      $tokens['user reference']['link']  = t('Formatted HTML link to referenced user');
167
-      $tokens['user reference']['path']  = t("Relative path alias to the referenced user.");
168
-      $tokens['user reference']['url']  = t("Absolute path alias to the referenced user.");
164
+        $tokens['user reference']['uid']   = t('Referenced user ID');
165
+        $tokens['user reference']['name']  = t('Referenced user name');
166
+        $tokens['user reference']['link']  = t('Formatted HTML link to referenced user');
167
+        $tokens['user reference']['path']  = t("Relative path alias to the referenced user.");
168
+        $tokens['user reference']['url']  = t("Absolute path alias to the referenced user.");
169 169
 
170
-      return $tokens;
170
+        return $tokens;
171
+    }
171 172
     }
172
-  }
173 173
 
174
-  function userreference_token_values($type, $object = NULL, $options = array()) {
174
+    function userreference_token_values($type, $object = NULL, $options = array()) {
175 175
     if ($type == 'field') {
176
-      $item = $object[0];
176
+        $item = $object[0];
177 177
 
178
-      $tokens['uid']   = $item['uid'];
179
-      $tokens['name']  = isset($item['view']) ? strip_tags($item['view']) : '';
180
-      $tokens['link']  = isset($item['view']) ? $item['view'] : '';
181
-      $tokens['path'] = is_numeric($item['uid']) ? url('user/' . $item['uid']) : '';
182
-      $tokens['url'] = is_numeric($item['uid']) ? url('user/' . $item['uid'], array('absolute' => TRUE)) : '';
178
+        $tokens['uid']   = $item['uid'];
179
+        $tokens['name']  = isset($item['view']) ? strip_tags($item['view']) : '';
180
+        $tokens['link']  = isset($item['view']) ? $item['view'] : '';
181
+        $tokens['path'] = is_numeric($item['uid']) ? url('user/' . $item['uid']) : '';
182
+        $tokens['url'] = is_numeric($item['uid']) ? url('user/' . $item['uid'], array('absolute' => TRUE)) : '';
183 183
 
184
-      return $tokens;
184
+        return $tokens;
185
+    }
185 186
     }
186
-  }
187 187
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
       $field_types = _content_field_types();
42 42
       foreach ($content_type['fields'] as $field_name => $field) {
43 43
         $items = isset($node->{$field_name}) ? $node->{$field_name} : array();
44
-        $function = $field_types[$field['type']]['module'] . '_token_values';
44
+        $function = $field_types[$field['type']]['module'].'_token_values';
45 45
         if (!empty($items) && function_exists($function)) {
46
-          $token_values = (array) $function('field', $items, $options);
46
+          $token_values = (array)$function('field', $items, $options);
47 47
           foreach ($token_values as $token => $value) {
48
-            $tokens[$field_name .'-'. $token] = $value;
48
+            $tokens[$field_name.'-'.$token] = $value;
49 49
           }
50 50
         }
51 51
       }
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 
62 62
     foreach (content_fields() as $field) {
63 63
       $sub_list = array();
64
-      $function = $field_types[$field['type']]['module'] . '_token_list';
64
+      $function = $field_types[$field['type']]['module'].'_token_list';
65 65
       if (function_exists($function)) {
66 66
         $sub_list = $function('field');
67 67
         foreach ($sub_list as $category => $token_list) {
68 68
           foreach ($token_list as $token => $description) {
69
-            $list['CCK '. $category][$field['field_name'] .'-'. $token] = $description;
69
+            $list['CCK '.$category][$field['field_name'].'-'.$token] = $description;
70 70
           }
71 71
         }
72 72
       }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
       $tokens['node reference']['title-raw'] = t('Referenced node unfiltered title. WARNING - raw user input.');
87 87
       $tokens['node reference']['link']  = t("Formatted html link to the referenced node.");
88 88
       $tokens['node reference']['path']  = t("Relative path alias to the referenced node.");
89
-      $tokens['node reference']['url']  = t("Absolute path alias to the referenced node.");
89
+      $tokens['node reference']['url'] = t("Absolute path alias to the referenced node.");
90 90
 
91 91
       return $tokens;
92 92
     }
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
       $tokens['title'] = $title ? check_plain($title) : '';
102 102
       $tokens['title-raw'] = $title;
103 103
       $tokens['link']  = isset($item['view']) ? $item['view'] : '';
104
-      $tokens['path'] = is_numeric($item['nid']) ? url('node/' . $item['nid']) : '';
105
-      $tokens['url'] = is_numeric($item['nid']) ? url('node/' . $item['nid'], array('absolute' => TRUE)) : '';
104
+      $tokens['path'] = is_numeric($item['nid']) ? url('node/'.$item['nid']) : '';
105
+      $tokens['url'] = is_numeric($item['nid']) ? url('node/'.$item['nid'], array('absolute' => TRUE)) : '';
106 106
 
107 107
       return $tokens;
108 108
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     if ($type == 'field') {
150 150
       $item = $object[0];
151 151
 
152
-      $tokens['raw']  = $item['value'];
152
+      $tokens['raw'] = $item['value'];
153 153
       $tokens['formatted'] = isset($item['view']) ? $item['view'] : '';
154 154
       return $tokens;
155 155
     }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
       $tokens['user reference']['name']  = t('Referenced user name');
166 166
       $tokens['user reference']['link']  = t('Formatted HTML link to referenced user');
167 167
       $tokens['user reference']['path']  = t("Relative path alias to the referenced user.");
168
-      $tokens['user reference']['url']  = t("Absolute path alias to the referenced user.");
168
+      $tokens['user reference']['url'] = t("Absolute path alias to the referenced user.");
169 169
 
170 170
       return $tokens;
171 171
     }
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
       $tokens['uid']   = $item['uid'];
179 179
       $tokens['name']  = isset($item['view']) ? strip_tags($item['view']) : '';
180 180
       $tokens['link']  = isset($item['view']) ? $item['view'] : '';
181
-      $tokens['path'] = is_numeric($item['uid']) ? url('user/' . $item['uid']) : '';
182
-      $tokens['url'] = is_numeric($item['uid']) ? url('user/' . $item['uid'], array('absolute' => TRUE)) : '';
181
+      $tokens['path'] = is_numeric($item['uid']) ? url('user/'.$item['uid']) : '';
182
+      $tokens['url'] = is_numeric($item['uid']) ? url('user/'.$item['uid'], array('absolute' => TRUE)) : '';
183 183
 
184 184
       return $tokens;
185 185
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
       'build modes' => array(
14 14
         'token' => array(
15 15
           'title' => t('Token'),
16
-          'views style' => FALSE,
16
+          'views style' => false,
17 17
         ),
18 18
       ),
19 19
     ),
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 }
22 22
 
23 23
 // Two helper functions that generate appropriate tokens for CCK-added fields.
24
-function content_token_values($type, $object = NULL, $options = array()) {
24
+function content_token_values($type, $object = null, $options = array()) {
25 25
   $tokens = array();
26 26
   if ($type == 'node') {
27 27
     // Prevent against invalid 'nodes' built by broken 3rd party code.
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     }
93 93
   }
94 94
 
95
-  function nodereference_token_values($type, $object = NULL, $options = array()) {
95
+  function nodereference_token_values($type, $object = null, $options = array()) {
96 96
     if ($type == 'field') {
97 97
       $item = $object[0];
98 98
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
       $tokens['title-raw'] = $title;
103 103
       $tokens['link']  = isset($item['view']) ? $item['view'] : '';
104 104
       $tokens['path'] = is_numeric($item['nid']) ? url('node/' . $item['nid']) : '';
105
-      $tokens['url'] = is_numeric($item['nid']) ? url('node/' . $item['nid'], array('absolute' => TRUE)) : '';
105
+      $tokens['url'] = is_numeric($item['nid']) ? url('node/' . $item['nid'], array('absolute' => true)) : '';
106 106
 
107 107
       return $tokens;
108 108
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     }
122 122
   }
123 123
 
124
-  function number_token_values($type, $object = NULL, $options = array()) {
124
+  function number_token_values($type, $object = null, $options = array()) {
125 125
     if ($type == 'field') {
126 126
       $item = $object[0];
127 127
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     }
146 146
   }
147 147
 
148
-  function text_token_values($type, $object = NULL, $options = array()) {
148
+  function text_token_values($type, $object = null, $options = array()) {
149 149
     if ($type == 'field') {
150 150
       $item = $object[0];
151 151
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     }
172 172
   }
173 173
 
174
-  function userreference_token_values($type, $object = NULL, $options = array()) {
174
+  function userreference_token_values($type, $object = null, $options = array()) {
175 175
     if ($type == 'field') {
176 176
       $item = $object[0];
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
       $tokens['name']  = isset($item['view']) ? strip_tags($item['view']) : '';
180 180
       $tokens['link']  = isset($item['view']) ? $item['view'] : '';
181 181
       $tokens['path'] = is_numeric($item['uid']) ? url('user/' . $item['uid']) : '';
182
-      $tokens['url'] = is_numeric($item['uid']) ? url('user/' . $item['uid'], array('absolute' => TRUE)) : '';
182
+      $tokens['url'] = is_numeric($item['uid']) ? url('user/' . $item['uid'], array('absolute' => true)) : '';
183 183
 
184 184
       return $tokens;
185 185
     }
Please login to merge, or discard this patch.
drupal/sites/default/boinc/modules/contrib/cck/includes/content.rules.inc 4 patches
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -10,34 +10,34 @@  discard block
 block discarded – undo
10 10
  * Implementation of hook_rules_action_info().
11 11
  */
12 12
 function content_rules_action_info() {
13
-  $info = array();
14
-  $info['content_rules_action_populate_field'] = array(
13
+    $info = array();
14
+    $info['content_rules_action_populate_field'] = array(
15 15
     'label' => t('Populate a field'),
16 16
     'arguments' => array(
17
-      'node' => array(
17
+        'node' => array(
18 18
         'type' => 'node',
19 19
         'label' => t('Content'),
20
-      ),
20
+        ),
21 21
     ),
22 22
     'eval input' => array('code'),
23 23
     'help' => t('You should make sure that the used field exists in the given content type.'),
24 24
     'module' => 'CCK',
25
-  );
26
-  return $info;
25
+    );
26
+    return $info;
27 27
 }
28 28
 
29 29
 /**
30 30
  * Action: populate a field.
31 31
  */
32 32
 function content_rules_action_populate_field($node, $settings, $element, &$state) {
33
-  // Get information about the field.
34
-  $field = content_fields($settings['field_name'], $node->type);
35
-  $value = _content_rules_get_field_value($settings, $state);
33
+    // Get information about the field.
34
+    $field = content_fields($settings['field_name'], $node->type);
35
+    $value = _content_rules_get_field_value($settings, $state);
36 36
 
37
-  if (!empty($field) && is_array($value)) {
37
+    if (!empty($field) && is_array($value)) {
38 38
     $node->$settings['field_name'] = $value;
39 39
     return array('node' => $node);
40
-  }
40
+    }
41 41
 }
42 42
 
43 43
 
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
  * This is a multistep form!
47 47
  */
48 48
 function content_rules_action_populate_field_form($settings, &$form, &$form_state) {
49
-  $settings += array('field_name' => '', 'code' => '', 'value' => NULL);
50
-  if (empty($settings['field_name'])) {
49
+    $settings += array('field_name' => '', 'code' => '', 'value' => NULL);
50
+    if (empty($settings['field_name'])) {
51 51
     $form['settings']['field_name'] = array(
52
-      '#type' => 'select',
53
-      '#title' => t('Field'),
54
-      '#options' => content_rules_get_field_names_by_type(),
55
-      '#default_value' => $settings['field_name'],
56
-      '#description' => t('Select the machine-name of the field.'),
57
-      '#required' => TRUE,
52
+        '#type' => 'select',
53
+        '#title' => t('Field'),
54
+        '#options' => content_rules_get_field_names_by_type(),
55
+        '#default_value' => $settings['field_name'],
56
+        '#description' => t('Select the machine-name of the field.'),
57
+        '#required' => TRUE,
58 58
     );
59 59
     // Hide some form elements in the first step.
60 60
     $form['negate']['#access'] = FALSE;
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     // Replace the usual submit handlers with a own handler.
65 65
     $form['submit']['#submit'] = array('content_rules_action_populate_field_form_step_submit');
66 66
     $form['submit']['#value'] = t('Continue');
67
-  }
68
-  else {
67
+    }
68
+    else {
69 69
     // Show the fields form here.
70 70
     module_load_include('inc', 'content', 'includes/content.node_form');
71 71
     $field = content_fields($settings['field_name']);
@@ -78,111 +78,111 @@  discard block
 block discarded – undo
78 78
 
79 79
     unset($form['#cache']);
80 80
 
81
-      // Advanced: PHP code.
81
+        // Advanced: PHP code.
82 82
     $form['advanced_options'] = array(
83
-      '#type' => 'fieldset',
84
-      '#title' => t('Advanced: Specify the fields value with PHP code'),
85
-      '#collapsible' => TRUE,
86
-      '#collapsed' => empty($settings['code']),
87
-      '#weight' => 5,
83
+        '#type' => 'fieldset',
84
+        '#title' => t('Advanced: Specify the fields value with PHP code'),
85
+        '#collapsible' => TRUE,
86
+        '#collapsed' => empty($settings['code']),
87
+        '#weight' => 5,
88 88
     );
89 89
 
90 90
     $db_info = content_database_info($field);
91 91
     $columns = array_keys($db_info['columns']);
92 92
     foreach ($columns as $key => $column) {
93
-      $columns[$key] = t("'@column' => value for @column", array('@column' => $column));
93
+        $columns[$key] = t("'@column' => value for @column", array('@column' => $column));
94 94
     }
95 95
     $sample = t("return array(\n  0 => array(@columns),\n  // You'll usually want to stop here. Provide more values\n  // if you want your 'default value' to be multi-valued:\n  1 => array(@columns),\n  2 => ...\n);", array('@columns' => implode(', ', $columns)));
96 96
 
97 97
     $form['advanced_options']['code'] = array(
98
-      '#type' => 'textarea',
99
-      '#title' => t('Code'),
100
-      '#default_value' => $settings['code'],
101
-      '#rows' => 6,
102
-      '#description' => t('Advanced usage only: PHP code that returns the value to set. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the value returned by this code will override any value specified above. Expected format: <pre>!sample</pre>Using <a href="@link_devel">devel.module\'s</a> \'devel load\' tab on a content page might help you figure out the expected format.', array(
98
+        '#type' => 'textarea',
99
+        '#title' => t('Code'),
100
+        '#default_value' => $settings['code'],
101
+        '#rows' => 6,
102
+        '#description' => t('Advanced usage only: PHP code that returns the value to set. Should not include &lt;?php ?&gt; delimiters. If this field is filled out, the value returned by this code will override any value specified above. Expected format: <pre>!sample</pre>Using <a href="@link_devel">devel.module\'s</a> \'devel load\' tab on a content page might help you figure out the expected format.', array(
103 103
         '!sample' => $sample,
104 104
         '@link_devel' => 'http://www.drupal.org/project/devel',
105
-      )),
105
+        )),
106 106
     );
107 107
 
108 108
     // Add this file to be included when the form is built by rules
109 109
     // as it's needed by CCKs add more button.
110 110
     // See rules_after_build_include_files().
111 111
     $form['#includes'][] = './'. drupal_get_path('module', 'node') .'/node.pages.inc';
112
-  }
112
+    }
113 113
 }
114 114
 
115 115
 function content_rules_action_populate_field_form_step_submit($form, &$form_state) {
116
-  $form_state['element']['#settings']['field_name'] = $form_state['values']['settings']['field_name'];
116
+    $form_state['element']['#settings']['field_name'] = $form_state['values']['settings']['field_name'];
117 117
 }
118 118
 
119 119
 /**
120 120
  * Validate the chosen value or php code.
121 121
  */
122 122
 function content_rules_action_populate_field_validate($form, &$form_state) {
123
-  if (!isset($form_state['element']['#settings']['field_name'])) {
123
+    if (!isset($form_state['element']['#settings']['field_name'])) {
124 124
     //Just validate the last step.
125 125
     return;
126
-  }
126
+    }
127 127
 
128
-  if (isset($form_state['values']['code']) && ($php = $form_state['values']['code'])) {
128
+    if (isset($form_state['values']['code']) && ($php = $form_state['values']['code'])) {
129 129
     if (strpos($php, 'return') === FALSE) {
130
-      form_set_error('code', t('You have to return the default value in the expected format.'));
130
+        form_set_error('code', t('You have to return the default value in the expected format.'));
131 131
     }
132
-  }
133
-  else {
132
+    }
133
+    else {
134 134
     // Validate the field.
135 135
     $settings = $form_state['element']['#settings'];
136 136
     $field = content_fields($settings['field_name']);
137 137
     $field_types = _content_field_types();
138 138
     $function = $field_types[$field['type']]['module'] .'_field';
139 139
     if (function_exists($function)) {
140
-      $form['#node'] = (object)array('type' => '', $settings['field_name'] => $form_state['values'][$settings['field_name']]);
141
-      $items = isset($form['#node']->$field['field_name']) ? $form['#node']->$field['field_name'] : array();
140
+        $form['#node'] = (object)array('type' => '', $settings['field_name'] => $form_state['values'][$settings['field_name']]);
141
+        $items = isset($form['#node']->$field['field_name']) ? $form['#node']->$field['field_name'] : array();
142 142
 
143
-      //Make sure AHAH 'add more' button isn't sent to the fields
144
-      // for processing.
145
-      unset($items[$field['field_name'] .'_add_more']);
143
+        //Make sure AHAH 'add more' button isn't sent to the fields
144
+        // for processing.
145
+        unset($items[$field['field_name'] .'_add_more']);
146 146
 
147
-      $function('validate', $form['#node'], $field, $items, $form, NULL);
148
-      content_field('validate', $form['#node'], $field, $items, $form, NULL);
147
+        $function('validate', $form['#node'], $field, $items, $form, NULL);
148
+        content_field('validate', $form['#node'], $field, $items, $form, NULL);
149
+    }
149 150
     }
150
-  }
151 151
 }
152 152
 
153 153
 function content_rules_action_populate_field_submit(&$settings, $form, &$form_state) {
154
-  // Take over field values and filter out private properties added by CCK
155
-  $settings['value'] = array_filter($form_state['values'][$settings['field_name']], 'is_array');
154
+    // Take over field values and filter out private properties added by CCK
155
+    $settings['value'] = array_filter($form_state['values'][$settings['field_name']], 'is_array');
156 156
 
157
-  foreach ($settings['value'] as $key => $data) {
157
+    foreach ($settings['value'] as $key => $data) {
158 158
     foreach (array_filter(array_keys($data)) as $col) {
159
-      if ($col[0] == '_') {
159
+        if ($col[0] == '_') {
160 160
         unset($settings['value'][$key][$col]);
161
-      }
161
+        }
162 162
     }
163 163
     if ($key && count(array_filter($settings['value'][$key])) == 0) {
164
-      // For multi-valued fields don't check for any additional empty values.
165
-      unset($settings['value'][$key]);
164
+        // For multi-valued fields don't check for any additional empty values.
165
+        unset($settings['value'][$key]);
166
+    }
166 167
     }
167
-  }
168 168
 
169
-  $settings['code'] = $form_state['values']['code'];
169
+    $settings['code'] = $form_state['values']['code'];
170 170
 
171
-  if (function_exists('rules_action_custom_php_submit')) {
171
+    if (function_exists('rules_action_custom_php_submit')) {
172 172
     // Support adding variables to the php code, if php module is present.
173 173
     rules_action_custom_php_submit($settings, $form, $form_state);
174
-  }
174
+    }
175 175
 
176
-  // Add all values to the input evaluator, so that textfields / textares can
177
-  // make use of it.
178
-  $names = array('code');
176
+    // Add all values to the input evaluator, so that textfields / textares can
177
+    // make use of it.
178
+    $names = array('code');
179 179
 
180
-  foreach ($settings['value'] as $key => $data) {
180
+    foreach ($settings['value'] as $key => $data) {
181 181
     foreach (array_filter($data, 'is_string') as $col => $value) {
182
-      $names[] = "value|$key|$col";
182
+        $names[] = "value|$key|$col";
183
+    }
183 184
     }
184
-  }
185
-  $form_state['element']['#info']['eval input'] = $names;
185
+    $form_state['element']['#info']['eval input'] = $names;
186 186
 }
187 187
 
188 188
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
  * Label callback: Improve the label of the action.
191 191
  */
192 192
 function content_rules_action_populate_field_label($settings, $argument_labels) {
193
-  return t("Populate @node's field '@field'", array('@field' => $settings['field_name']) + $argument_labels);
193
+    return t("Populate @node's field '@field'", array('@field' => $settings['field_name']) + $argument_labels);
194 194
 }
195 195
 
196 196
 function workflow_ng_action_populate_field_upgrade(&$element) {
197
-  $element['#name'] = 'content_rules_action_populate_field';
198
-  $element['#settings']['code'] = $element['#settings']['default_value_php'];
199
-  $element['#settings'][$element['#settings']['field_name']] = array();
200
-  unset($element['#settings']['default_value_php']);
197
+    $element['#name'] = 'content_rules_action_populate_field';
198
+    $element['#settings']['code'] = $element['#settings']['default_value_php'];
199
+    $element['#settings'][$element['#settings']['field_name']] = array();
200
+    unset($element['#settings']['default_value_php']);
201 201
 }
202 202
 
203 203
 
@@ -205,84 +205,84 @@  discard block
 block discarded – undo
205 205
  * Implementation of hook_rules_condition_info().
206 206
  */
207 207
 function content_rules_condition_info() {
208
-  $info = array();
209
-  $info['content_rules_field_has_value'] = array(
208
+    $info = array();
209
+    $info['content_rules_field_has_value'] = array(
210 210
     'label' => t('Field has value'),
211 211
     'arguments' => array(
212
-      'node' => array('type' => 'node', 'label' => t('Content')),
212
+        'node' => array('type' => 'node', 'label' => t('Content')),
213 213
     ),
214 214
     'eval input' => array('code'),
215 215
     'help' => t('You should make sure that the used field exists in the given content type. The condition returns TRUE, if the selected field has the given value.'),
216 216
     'module' => 'CCK',
217
-  );
218
-  $info['content_rules_field_changed'] = array(
217
+    );
218
+    $info['content_rules_field_changed'] = array(
219 219
     'label' => t('Field has changed'),
220 220
     'arguments' => array(
221
-      'node' => array('type' => 'node', 'label' => t('Content containing changes')),
222
-      'node_unchanged' => array('type' => 'node', 'label' => t('Content not containing changes')),
221
+        'node' => array('type' => 'node', 'label' => t('Content containing changes')),
222
+        'node_unchanged' => array('type' => 'node', 'label' => t('Content not containing changes')),
223 223
     ),
224 224
     'help' => t('You should make sure that the used field exists in the given content type.'),
225 225
     'module' => 'CCK',
226
-  );
227
-  return $info;
226
+    );
227
+    return $info;
228 228
 }
229 229
 
230 230
 /**
231 231
  * Condition: Check the value of a field.
232 232
  */
233 233
 function content_rules_field_has_value($node, $settings) {
234
-  // Get information about the field.
235
-  $field = content_fields($settings['field_name'], $node->type);
236
-  $value = _content_rules_get_field_value($settings, $state);
234
+    // Get information about the field.
235
+    $field = content_fields($settings['field_name'], $node->type);
236
+    $value = _content_rules_get_field_value($settings, $state);
237 237
 
238
-  if (empty($field) || !is_array($value)) {
238
+    if (empty($field) || !is_array($value)) {
239 239
     return FALSE;
240
-  }
240
+    }
241 241
 
242
-  return _content_rules_field_has_value($node->$settings['field_name'], $value);
242
+    return _content_rules_field_has_value($node->$settings['field_name'], $value);
243 243
 }
244 244
 
245 245
 /**
246 246
  * Use the same configuration form as the "populate field" action.
247 247
  */
248 248
 function content_rules_field_has_value_form($settings, &$form, &$form_state) {
249
-  content_rules_action_populate_field_form($settings, $form, $form_state);
249
+    content_rules_action_populate_field_form($settings, $form, $form_state);
250 250
 }
251 251
 function content_rules_field_has_value_validate($form, &$form_state) {
252
-  content_rules_action_populate_field_validate($form, $form_state);
252
+    content_rules_action_populate_field_validate($form, $form_state);
253 253
 }
254 254
 function content_rules_field_has_value_submit(&$settings, $form, &$form_state) {
255
-  content_rules_action_populate_field_submit($settings, $form, $form_state);
255
+    content_rules_action_populate_field_submit($settings, $form, $form_state);
256 256
 }
257 257
 
258 258
 function content_rules_field_has_value_label($settings, $argument_labels) {
259
-  return t("@node's field '@field' has value", array('@field' => $settings['field_name']) + $argument_labels);
259
+    return t("@node's field '@field' has value", array('@field' => $settings['field_name']) + $argument_labels);
260 260
 }
261 261
 
262 262
 /**
263 263
  * Condition: Check if the field has changed.
264 264
  */
265 265
 function content_rules_field_changed($node1, $node2, $settings) {
266
-  // Get information about the field.
267
-  $field = content_fields($settings['field_name'], $node1->type);
266
+    // Get information about the field.
267
+    $field = content_fields($settings['field_name'], $node1->type);
268 268
 
269
-  return !empty($field) && !_content_rules_field_has_value($node1->$settings['field_name'], $node2->$settings['field_name']);
269
+    return !empty($field) && !_content_rules_field_has_value($node1->$settings['field_name'], $node2->$settings['field_name']);
270 270
 }
271 271
 
272 272
 function content_rules_field_changed_form($settings, &$form, &$form_state) {
273
-  $settings += array('field_name' => '');
274
-  $form['settings']['field_name'] = array(
273
+    $settings += array('field_name' => '');
274
+    $form['settings']['field_name'] = array(
275 275
     '#type' => 'select',
276 276
     '#title' => t('Field'),
277 277
     '#options' => content_rules_get_field_names_by_type(),
278 278
     '#default_value' => $settings['field_name'],
279 279
     '#description' => t('Select the machine-name of the field to look at.'),
280 280
     '#required' => TRUE,
281
-  );
281
+    );
282 282
 }
283 283
 
284 284
 function content_rules_field_changed_label($settings, $argument_labels) {
285
-  return t("@node's field '@field' has been changed", array('@field' => $settings['field_name']) + $argument_labels);
285
+    return t("@node's field '@field' has been changed", array('@field' => $settings['field_name']) + $argument_labels);
286 286
 }
287 287
 
288 288
 
@@ -291,32 +291,32 @@  discard block
 block discarded – undo
291 291
  * Suitable for using it with #options.
292 292
  */
293 293
 function content_rules_get_field_names_by_type($type = NULL) {
294
-  $fields = array();
295
-  foreach (content_fields() as $field) {
294
+    $fields = array();
295
+    foreach (content_fields() as $field) {
296 296
     if (!isset($type) || $field['type'] == $type) {
297
-      $fields[$field['field_name']] = $field['field_name'];
297
+        $fields[$field['field_name']] = $field['field_name'];
298
+    }
298 299
     }
299
-  }
300
-  asort($fields);
301
-  return $fields;
300
+    asort($fields);
301
+    return $fields;
302 302
 }
303 303
 
304 304
 function _content_rules_get_field_value($settings, &$state) {
305
-  if ($settings['code']) {
305
+    if ($settings['code']) {
306 306
     if (function_exists('rules_input_evaluator_php_apply')) {
307
-      // Support adding variables to the php code, if php module is present.
308
-      $value = rules_input_evaluator_php_apply($settings['code'], $settings['vars'], $state, FALSE);
307
+        // Support adding variables to the php code, if php module is present.
308
+        $value = rules_input_evaluator_php_apply($settings['code'], $settings['vars'], $state, FALSE);
309 309
     }
310 310
     else {
311
-      ob_start();
312
-      $value = eval($settings['code']);
313
-      ob_end_clean();
311
+        ob_start();
312
+        $value = eval($settings['code']);
313
+        ob_end_clean();
314 314
     }
315
-  }
316
-  else {
315
+    }
316
+    else {
317 317
     $value = $settings['value'];
318
-  }
319
-  return $value;
318
+    }
319
+    return $value;
320 320
 }
321 321
 
322 322
 /**
@@ -329,20 +329,20 @@  discard block
 block discarded – undo
329 329
  * @param $value The value to check for.
330 330
  */
331 331
 function _content_rules_field_has_value($node_value, $value) {
332
-  if (count($value) != count($node_value)) {
332
+    if (count($value) != count($node_value)) {
333 333
     return FALSE;
334
-  }
335
-  // Loop over multiple fields
336
-  foreach ($value as $delta => $sub_value) {
334
+    }
335
+    // Loop over multiple fields
336
+    foreach ($value as $delta => $sub_value) {
337 337
     // Check if all properties of the value are there in the node value too
338 338
     if (is_array($sub_value) && is_array($node_value[$delta])) {
339
-      if (count(array_diff_assoc($sub_value, $node_value[$delta])) != 0) {
339
+        if (count(array_diff_assoc($sub_value, $node_value[$delta])) != 0) {
340 340
         return FALSE;
341
-      }
341
+        }
342 342
     }
343 343
     elseif ($sub_value !== $node_value[$delta]) {
344
-      return FALSE;
344
+        return FALSE;
345
+    }
345 346
     }
346
-  }
347
-  return TRUE;
347
+    return TRUE;
348 348
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
     $form['#node'] = (object)array('type' => '', $settings['field_name'] => $settings['value']);
74 74
     $form['#field_info'][$field['field_name']] = $field;
75 75
     // We can't put it into $form['settings'] as this would break AHAH callbacks
76
-    $form += (array) content_field_form($form, $form_state, $field);
77
-    $form[ $settings['field_name'] ]['#weight'] = 4;
76
+    $form += (array)content_field_form($form, $form_state, $field);
77
+    $form[$settings['field_name']]['#weight'] = 4;
78 78
 
79 79
     unset($form['#cache']);
80 80
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     // Add this file to be included when the form is built by rules
109 109
     // as it's needed by CCKs add more button.
110 110
     // See rules_after_build_include_files().
111
-    $form['#includes'][] = './'. drupal_get_path('module', 'node') .'/node.pages.inc';
111
+    $form['#includes'][] = './'.drupal_get_path('module', 'node').'/node.pages.inc';
112 112
   }
113 113
 }
114 114
 
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
     $settings = $form_state['element']['#settings'];
136 136
     $field = content_fields($settings['field_name']);
137 137
     $field_types = _content_field_types();
138
-    $function = $field_types[$field['type']]['module'] .'_field';
138
+    $function = $field_types[$field['type']]['module'].'_field';
139 139
     if (function_exists($function)) {
140 140
       $form['#node'] = (object)array('type' => '', $settings['field_name'] => $form_state['values'][$settings['field_name']]);
141 141
       $items = isset($form['#node']->$field['field_name']) ? $form['#node']->$field['field_name'] : array();
142 142
 
143 143
       //Make sure AHAH 'add more' button isn't sent to the fields
144 144
       // for processing.
145
-      unset($items[$field['field_name'] .'_add_more']);
145
+      unset($items[$field['field_name'].'_add_more']);
146 146
 
147 147
       $function('validate', $form['#node'], $field, $items, $form, NULL);
148 148
       content_field('validate', $form['#node'], $field, $items, $form, NULL);
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -64,8 +64,7 @@  discard block
 block discarded – undo
64 64
     // Replace the usual submit handlers with a own handler.
65 65
     $form['submit']['#submit'] = array('content_rules_action_populate_field_form_step_submit');
66 66
     $form['submit']['#value'] = t('Continue');
67
-  }
68
-  else {
67
+  } else {
69 68
     // Show the fields form here.
70 69
     module_load_include('inc', 'content', 'includes/content.node_form');
71 70
     $field = content_fields($settings['field_name']);
@@ -129,8 +128,7 @@  discard block
 block discarded – undo
129 128
     if (strpos($php, 'return') === FALSE) {
130 129
       form_set_error('code', t('You have to return the default value in the expected format.'));
131 130
     }
132
-  }
133
-  else {
131
+  } else {
134 132
     // Validate the field.
135 133
     $settings = $form_state['element']['#settings'];
136 134
     $field = content_fields($settings['field_name']);
@@ -306,14 +304,12 @@  discard block
 block discarded – undo
306 304
     if (function_exists('rules_input_evaluator_php_apply')) {
307 305
       // Support adding variables to the php code, if php module is present.
308 306
       $value = rules_input_evaluator_php_apply($settings['code'], $settings['vars'], $state, FALSE);
309
-    }
310
-    else {
307
+    } else {
311 308
       ob_start();
312 309
       $value = eval($settings['code']);
313 310
       ob_end_clean();
314 311
     }
315
-  }
316
-  else {
312
+  } else {
317 313
     $value = $settings['value'];
318 314
   }
319 315
   return $value;
@@ -339,8 +335,7 @@  discard block
 block discarded – undo
339 335
       if (count(array_diff_assoc($sub_value, $node_value[$delta])) != 0) {
340 336
         return FALSE;
341 337
       }
342
-    }
343
-    elseif ($sub_value !== $node_value[$delta]) {
338
+    } elseif ($sub_value !== $node_value[$delta]) {
344 339
       return FALSE;
345 340
     }
346 341
   }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  * This is a multistep form!
47 47
  */
48 48
 function content_rules_action_populate_field_form($settings, &$form, &$form_state) {
49
-  $settings += array('field_name' => '', 'code' => '', 'value' => NULL);
49
+  $settings += array('field_name' => '', 'code' => '', 'value' => null);
50 50
   if (empty($settings['field_name'])) {
51 51
     $form['settings']['field_name'] = array(
52 52
       '#type' => 'select',
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
       '#options' => content_rules_get_field_names_by_type(),
55 55
       '#default_value' => $settings['field_name'],
56 56
       '#description' => t('Select the machine-name of the field.'),
57
-      '#required' => TRUE,
57
+      '#required' => true,
58 58
     );
59 59
     // Hide some form elements in the first step.
60
-    $form['negate']['#access'] = FALSE;
61
-    $form['input_help']['#access'] = FALSE;
62
-    $form['weight']['#access'] = FALSE;
60
+    $form['negate']['#access'] = false;
61
+    $form['input_help']['#access'] = false;
62
+    $form['weight']['#access'] = false;
63 63
 
64 64
     // Replace the usual submit handlers with a own handler.
65 65
     $form['submit']['#submit'] = array('content_rules_action_populate_field_form_step_submit');
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     $form['advanced_options'] = array(
83 83
       '#type' => 'fieldset',
84 84
       '#title' => t('Advanced: Specify the fields value with PHP code'),
85
-      '#collapsible' => TRUE,
85
+      '#collapsible' => true,
86 86
       '#collapsed' => empty($settings['code']),
87 87
       '#weight' => 5,
88 88
     );
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
   }
127 127
 
128 128
   if (isset($form_state['values']['code']) && ($php = $form_state['values']['code'])) {
129
-    if (strpos($php, 'return') === FALSE) {
129
+    if (strpos($php, 'return') === false) {
130 130
       form_set_error('code', t('You have to return the default value in the expected format.'));
131 131
     }
132 132
   }
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
       // for processing.
145 145
       unset($items[$field['field_name'] .'_add_more']);
146 146
 
147
-      $function('validate', $form['#node'], $field, $items, $form, NULL);
148
-      content_field('validate', $form['#node'], $field, $items, $form, NULL);
147
+      $function('validate', $form['#node'], $field, $items, $form, null);
148
+      content_field('validate', $form['#node'], $field, $items, $form, null);
149 149
     }
150 150
   }
151 151
 }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
   $value = _content_rules_get_field_value($settings, $state);
237 237
 
238 238
   if (empty($field) || !is_array($value)) {
239
-    return FALSE;
239
+    return false;
240 240
   }
241 241
 
242 242
   return _content_rules_field_has_value($node->$settings['field_name'], $value);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     '#options' => content_rules_get_field_names_by_type(),
278 278
     '#default_value' => $settings['field_name'],
279 279
     '#description' => t('Select the machine-name of the field to look at.'),
280
-    '#required' => TRUE,
280
+    '#required' => true,
281 281
   );
282 282
 }
283 283
 
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
  * Returns the fields of a given field type only.
291 291
  * Suitable for using it with #options.
292 292
  */
293
-function content_rules_get_field_names_by_type($type = NULL) {
293
+function content_rules_get_field_names_by_type($type = null) {
294 294
   $fields = array();
295 295
   foreach (content_fields() as $field) {
296 296
     if (!isset($type) || $field['type'] == $type) {
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
   if ($settings['code']) {
306 306
     if (function_exists('rules_input_evaluator_php_apply')) {
307 307
       // Support adding variables to the php code, if php module is present.
308
-      $value = rules_input_evaluator_php_apply($settings['code'], $settings['vars'], $state, FALSE);
308
+      $value = rules_input_evaluator_php_apply($settings['code'], $settings['vars'], $state, false);
309 309
     }
310 310
     else {
311 311
       ob_start();
@@ -330,19 +330,19 @@  discard block
 block discarded – undo
330 330
  */
331 331
 function _content_rules_field_has_value($node_value, $value) {
332 332
   if (count($value) != count($node_value)) {
333
-    return FALSE;
333
+    return false;
334 334
   }
335 335
   // Loop over multiple fields
336 336
   foreach ($value as $delta => $sub_value) {
337 337
     // Check if all properties of the value are there in the node value too
338 338
     if (is_array($sub_value) && is_array($node_value[$delta])) {
339 339
       if (count(array_diff_assoc($sub_value, $node_value[$delta])) != 0) {
340
-        return FALSE;
340
+        return false;
341 341
       }
342 342
     }
343 343
     elseif ($sub_value !== $node_value[$delta]) {
344
-      return FALSE;
344
+      return false;
345 345
     }
346 346
   }
347
-  return TRUE;
347
+  return true;
348 348
 }
Please login to merge, or discard this patch.
contrib/cck/modules/fieldgroup/panels/content_types/content_fieldgroup.inc 2 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -10,155 +10,155 @@
 block discarded – undo
10 10
  * Callback function to supply a list of content types.
11 11
  */
12 12
 function fieldgroup_content_fieldgroup_ctools_content_types() {
13
-  return array(
13
+    return array(
14 14
     'title' => t('Content fieldgroup'),
15 15
     'defaults' => array('label' => 'hidden', 'format' => 'simple', 'empty' => ''),
16
-  );
16
+    );
17 17
 }
18 18
 
19 19
 /**
20 20
  * Return all fieldgroup content types available.
21 21
  */
22 22
 function fieldgroup_content_fieldgroup_content_type_content_types() {
23
-  // This will hold all the individual fieldgroup content types.
24
-  $types = array();
23
+    // This will hold all the individual fieldgroup content types.
24
+    $types = array();
25 25
 
26
-  // The outer loop goes through each node type with groups.
27
-  foreach (fieldgroup_groups() as $node_type_groups) {
26
+    // The outer loop goes through each node type with groups.
27
+    foreach (fieldgroup_groups() as $node_type_groups) {
28 28
     // The inner loop gives us each fieldgroup on each node type with groups.
29 29
     foreach ($node_type_groups as $group) {
30
-      // Skip field groups that are not of standard type.
31
-      if ($group['group_type'] != 'standard') {
30
+        // Skip field groups that are not of standard type.
31
+        if ($group['group_type'] != 'standard') {
32 32
         continue;
33
-      }
33
+        }
34 34
 
35
-      // Name the content type a combination of fieldgroup and node type names.
36
-      $content_type_name = $group['type_name'] . ':' . $group['group_name'];
35
+        // Name the content type a combination of fieldgroup and node type names.
36
+        $content_type_name = $group['type_name'] . ':' . $group['group_name'];
37 37
 
38
-      // Assemble the information about the content type.
39
-      $info = array(
38
+        // Assemble the information about the content type.
39
+        $info = array(
40 40
         'category' => t('Node'),
41 41
         'icon' => 'icon_cck_field_group.png',
42 42
         'title' => t('Field group: @group in @type', array(
43
-          '@group' => t($group['label']),
44
-          '@type' => node_get_types('name', $group['type_name']),
43
+            '@group' => t($group['label']),
44
+            '@type' => node_get_types('name', $group['type_name']),
45 45
         )),
46 46
         'description' => t('All fields from this field group on the referenced node.'),
47 47
         'required context' => new ctools_context_required(t('Node'), 'node', array('type' => array($group['type_name']))),
48
-      );
48
+        );
49 49
 
50
-      $types[$content_type_name] = $info;
50
+        $types[$content_type_name] = $info;
51
+    }
51 52
     }
52
-  }
53 53
 
54
-  return $types;
54
+    return $types;
55 55
 }
56 56
 
57 57
 /**
58 58
  * Output function for the 'fieldgroup' content type.
59 59
  */
60 60
 function fieldgroup_content_fieldgroup_content_type_render($subtype, $conf, $panel_args, $context) {
61
-  if (!isset($context->data)) {
61
+    if (!isset($context->data)) {
62 62
     return;
63
-  }
64
-  $node = drupal_clone($context->data);
63
+    }
64
+    $node = drupal_clone($context->data);
65 65
 
66
-  // Make sure old data doesn't cause problems:
67
-  if (empty($conf['label'])) {
66
+    // Make sure old data doesn't cause problems:
67
+    if (empty($conf['label'])) {
68 68
     $conf['label'] = 'hidden';
69
-  }
70
-  if (empty($conf['format'])) {
69
+    }
70
+    if (empty($conf['format'])) {
71 71
     $conf['format'] = 'simple';
72
-  }
72
+    }
73 73
 
74
-  // Extract the node type and fieldgroup name from the subtype.
75
-  list($node_type, $group_name) = explode(':', $subtype, 2);
74
+    // Extract the node type and fieldgroup name from the subtype.
75
+    list($node_type, $group_name) = explode(':', $subtype, 2);
76 76
 
77
-  // Get a list of all fieldgroups for this node type.
78
-  $groups = fieldgroup_groups($node_type);
77
+    // Get a list of all fieldgroups for this node type.
78
+    $groups = fieldgroup_groups($node_type);
79 79
 
80
-  if (!isset($groups[$group_name])) {
80
+    if (!isset($groups[$group_name])) {
81 81
     return;
82
-  }
83
-  $group = $groups[$group_name];
84
-
85
-  // Render the field group.
86
-  $node->build_mode = NODE_BUILD_NORMAL;
87
-  $group['settings']['display']['label'] = $conf['label'] == 'normal' || !empty($conf['override_title']) ? 'hidden' : $conf['label'];
88
-  $group['settings']['display']['full']['format'] = $conf['format'];
89
-  $group['settings']['display']['full']['exclude'] = 0;
90
-  $output = fieldgroup_view_group($group, $node);
91
-
92
-  $block = new stdClass();
93
-  if ($conf['label'] == 'normal') {
82
+    }
83
+    $group = $groups[$group_name];
84
+
85
+    // Render the field group.
86
+    $node->build_mode = NODE_BUILD_NORMAL;
87
+    $group['settings']['display']['label'] = $conf['label'] == 'normal' || !empty($conf['override_title']) ? 'hidden' : $conf['label'];
88
+    $group['settings']['display']['full']['format'] = $conf['format'];
89
+    $group['settings']['display']['full']['exclude'] = 0;
90
+    $output = fieldgroup_view_group($group, $node);
91
+
92
+    $block = new stdClass();
93
+    if ($conf['label'] == 'normal') {
94 94
     $block->title = t($group['label']);
95
-  }
96
-  $block->content = !empty($output) ? $output : $conf['empty'];
97
-  return $block;
95
+    }
96
+    $block->content = !empty($output) ? $output : $conf['empty'];
97
+    return $block;
98 98
 }
99 99
 
100 100
 /**
101 101
  * Returns a settings form for the custom type.
102 102
  */
103 103
 function fieldgroup_content_fieldgroup_content_type_edit_form(&$form, &$form_state) {
104
-  $conf = $form_state['conf'];
104
+    $conf = $form_state['conf'];
105 105
 
106
-  $label_options = array(
106
+    $label_options = array(
107 107
     'normal' => t('Block title'),
108 108
     'above' => t('Above'),
109
-  );
110
-  $form['label'] = array(
109
+    );
110
+    $form['label'] = array(
111 111
     '#type' => 'select',
112 112
     '#title' => t('Field group label'),
113 113
     '#default_value' => !empty($conf['label']) && isset($label_options[$conf['label']]) ? $conf['label'] : 'hidden',
114 114
     '#options' => $label_options,
115 115
     '#description' => t('Configure how the field group label is going to be displayed. This option takes no effect when "Override title" option is enabled, the specified block title is displayed instead.'),
116
-  );
116
+    );
117 117
 
118
-  $format_options = array(
118
+    $format_options = array(
119 119
     'simple' => t('Simple'),
120 120
     'fieldset' => t('Fieldset'),
121 121
     'fieldset_collapsible' => t('Fieldset - Collapsible'),
122 122
     'fieldset_collapsed' => t('Fieldset - Collapsed'),
123
-  );
124
-  $form['format'] = array(
123
+    );
124
+    $form['format'] = array(
125 125
     '#type' => 'select',
126 126
     '#title' => t('Field group format'),
127 127
     '#default_value' => !empty($conf['format']) && isset($format_options[$conf['format']]) ? $conf['format'] : 'simple',
128 128
     '#options' => $format_options,
129 129
     '#description' => t('This option allows you to configure the field group format.'),
130
-  );
130
+    );
131 131
 
132
-  $form['empty'] = array(
132
+    $form['empty'] = array(
133 133
     '#type' => 'textarea',
134 134
     '#title' => t('Empty text'),
135 135
     '#description' => t('Text to display if group has no data. Note that title will not display unless overridden.'),
136 136
     '#rows' => 5,
137 137
     '#default_value' => $conf['empty'],
138
-  );
138
+    );
139 139
 }
140 140
 
141 141
 function fieldgroup_content_fieldgroup_content_type_edit_form_submit(&$form, &$form_state) {
142
-  // Copy everything from our defaults.
143
-  foreach (array_keys($form_state['plugin']['defaults']) as $key) {
142
+    // Copy everything from our defaults.
143
+    foreach (array_keys($form_state['plugin']['defaults']) as $key) {
144 144
     $form_state['conf'][$key] = $form_state['values'][$key];
145
-  }
145
+    }
146 146
 }
147 147
 
148 148
 /**
149 149
  * Admin title for fieldgroup content type.
150 150
  */
151 151
 function fieldgroup_content_fieldgroup_content_type_admin_title($subtype, $conf, $context) {
152
-  // Extract the node type and fieldgroup name from the subtype.
153
-  list($node_type, $group_name) = explode(':', $subtype, 2);
152
+    // Extract the node type and fieldgroup name from the subtype.
153
+    list($node_type, $group_name) = explode(':', $subtype, 2);
154 154
 
155
-  // Get information about this field group for this node type.
156
-  $groups = fieldgroup_groups($node_type);
157
-  $group = $groups[$group_name];
155
+    // Get information about this field group for this node type.
156
+    $groups = fieldgroup_groups($node_type);
157
+    $group = $groups[$group_name];
158 158
 
159
-  return t('"@s" field group: @group in @type', array(
159
+    return t('"@s" field group: @group in @type', array(
160 160
     '@s' => $context->identifier,
161 161
     '@group' => t($group['label']),
162 162
     '@type' => node_get_types('name', $node_type),
163
-  ));
163
+    ));
164 164
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
       }
34 34
 
35 35
       // Name the content type a combination of fieldgroup and node type names.
36
-      $content_type_name = $group['type_name'] . ':' . $group['group_name'];
36
+      $content_type_name = $group['type_name'].':'.$group['group_name'];
37 37
 
38 38
       // Assemble the information about the content type.
39 39
       $info = array(
Please login to merge, or discard this patch.
default/boinc/modules/contrib/cck/modules/fieldgroup/fieldgroup.module 5 patches
Indentation   +366 added lines, -366 removed lines patch added patch discarded remove patch
@@ -16,230 +16,230 @@  discard block
 block discarded – undo
16 16
  * Implementation of hook_init().
17 17
  */
18 18
 function fieldgroup_init() {
19
-  drupal_add_css(drupal_get_path('module', 'fieldgroup') .'/fieldgroup.css');
19
+    drupal_add_css(drupal_get_path('module', 'fieldgroup') .'/fieldgroup.css');
20 20
 }
21 21
 
22 22
 /**
23 23
  * Implementation of hook_ctools_plugin_directory().
24 24
  */
25 25
 function fieldgroup_ctools_plugin_directory($module, $plugin) {
26
-  if ($module == 'ctools' && $plugin == 'content_types') {
26
+    if ($module == 'ctools' && $plugin == 'content_types') {
27 27
     return 'panels/' . $plugin;
28
-  }
28
+    }
29 29
 }
30 30
 
31 31
 /**
32 32
  * Implementation of hook_menu().
33 33
  */
34 34
 function fieldgroup_menu() {
35
-  $items = array();
35
+    $items = array();
36 36
 
37
-  // Make sure this doesn't fire until content_types is working,
38
-  // needed to avoid errors on initial installation.
39
-  if (!defined('MAINTENANCE_MODE')) {
37
+    // Make sure this doesn't fire until content_types is working,
38
+    // needed to avoid errors on initial installation.
39
+    if (!defined('MAINTENANCE_MODE')) {
40 40
     foreach (node_get_types() as $type) {
41
-      $type_name = $type->type;
42
-      $content_type = content_types($type_name);
43
-      $type_url_str = $content_type['url_str'];
44
-      $items['admin/content/node-type/'. $type_url_str .'/groups/%'] = array(
41
+        $type_name = $type->type;
42
+        $content_type = content_types($type_name);
43
+        $type_url_str = $content_type['url_str'];
44
+        $items['admin/content/node-type/'. $type_url_str .'/groups/%'] = array(
45 45
         'title' => 'Edit group',
46 46
         'page callback' => 'drupal_get_form',
47 47
         'page arguments' => array('fieldgroup_group_edit_form', $type_name, 5),
48 48
         'access arguments' => array('administer content types'),
49 49
         'type' => MENU_CALLBACK,
50
-      );
51
-      $items['admin/content/node-type/'. $type_url_str .'/groups/%/remove'] = array(
50
+        );
51
+        $items['admin/content/node-type/'. $type_url_str .'/groups/%/remove'] = array(
52 52
         'title' => 'Edit group',
53 53
         'page callback' => 'drupal_get_form',
54 54
         'page arguments' => array('fieldgroup_remove_group', $type_name, 5),
55 55
         'access arguments' => array('administer content types'),
56 56
         'type' => MENU_CALLBACK,
57
-      );
57
+        );
58 58
     }
59
-  }
60
-  return $items;
59
+    }
60
+    return $items;
61 61
 }
62 62
 
63 63
 /**
64 64
  * Implementation of hook_theme().
65 65
  */
66 66
 function fieldgroup_theme() {
67
-  return array(
67
+    return array(
68 68
     'fieldgroup_simple' => array(
69
-      'template' => 'fieldgroup-simple',
70
-      'arguments' => array('element' => NULL),
69
+        'template' => 'fieldgroup-simple',
70
+        'arguments' => array('element' => NULL),
71 71
     ),
72 72
     'fieldgroup_fieldset' => array(
73
-      'arguments' => array('element' => NULL),
73
+        'arguments' => array('element' => NULL),
74 74
     ),
75 75
     'fieldgroup_display_overview_form' => array(
76
-      'arguments' => array('form' => NULL),
76
+        'arguments' => array('form' => NULL),
77 77
     ),
78
-  );
78
+    );
79 79
 }
80 80
 
81 81
 /**
82 82
  * Implementation of hook_elements().
83 83
  */
84 84
 function fieldgroup_elements() {
85
-  return array(
85
+    return array(
86 86
     'fieldgroup_simple' => array(),
87 87
     'fieldgroup_fieldset' => array('#collapsible' => FALSE, '#collapsed' => FALSE, '#value' => NULL,),
88
-  );
88
+    );
89 89
 }
90 90
 
91 91
 /**
92 92
  * Implementation of hook_fieldapi().
93 93
  */
94 94
 function fieldgroup_content_fieldapi($op, $field) {
95
-  switch ($op) {
95
+    switch ($op) {
96 96
     case 'delete instance':
97 97
       db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']);
98
-      cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
99
-      break;
100
-  }
98
+        cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
99
+        break;
100
+    }
101 101
 }
102 102
 
103 103
 function fieldgroup_group_edit_form(&$form_state, $type_name, $group_name) {
104
-  $content_type = content_types($type_name);
105
-  $groups = fieldgroup_groups($content_type['type']);
104
+    $content_type = content_types($type_name);
105
+    $groups = fieldgroup_groups($content_type['type']);
106 106
 
107
-  if (!$group = $groups[$group_name]) {
107
+    if (!$group = $groups[$group_name]) {
108 108
     drupal_not_found();
109 109
     exit;
110
-  }
110
+    }
111 111
 
112
-  $form['label'] = array(
112
+    $form['label'] = array(
113 113
     '#type' => 'textfield',
114 114
     '#title' => t('Label'),
115 115
     '#default_value' => $group['label'],
116 116
     '#required' => TRUE,
117
-  );
117
+    );
118 118
 
119
-  // Set a default value for group type early in the form so it
120
-  // can be overridden by subsequent form elements added by other modules.
121
-  $group_type = !empty($group['group_type']) ? $group['group_type'] : 'standard';
122
-  $form['group_type'] = array('#type' => 'hidden', '#default_value' => $group_type);
119
+    // Set a default value for group type early in the form so it
120
+    // can be overridden by subsequent form elements added by other modules.
121
+    $group_type = !empty($group['group_type']) ? $group['group_type'] : 'standard';
122
+    $form['group_type'] = array('#type' => 'hidden', '#default_value' => $group_type);
123 123
 
124
-  $form['settings']['#tree'] = TRUE;
125
-  $form['settings']['form'] = array(
124
+    $form['settings']['#tree'] = TRUE;
125
+    $form['settings']['form'] = array(
126 126
     '#type' => 'fieldset',
127 127
     '#title' => t('Form settings'),
128 128
     '#description' => t('These settings apply to the group in the node editing form.'),
129
-  );
130
-  $form['settings']['form']['style'] = array(
129
+    );
130
+    $form['settings']['form']['style'] = array(
131 131
     '#type' => 'radios',
132 132
     '#title' => t('Style'),
133 133
     '#default_value' => $group['settings']['form']['style'],
134 134
     '#options' => array(
135
-      'fieldset' => t('always open'),
136
-      'fieldset_collapsible' => t('collapsible'),
137
-      'fieldset_collapsed' => t('collapsed'),
135
+        'fieldset' => t('always open'),
136
+        'fieldset_collapsible' => t('collapsible'),
137
+        'fieldset_collapsed' => t('collapsed'),
138 138
     )
139
-  );
140
-  $form['settings']['form']['description'] = array(
139
+    );
140
+    $form['settings']['form']['description'] = array(
141 141
     '#type' => 'textarea',
142 142
     '#title' => t('Help text'),
143 143
     '#default_value' => $group['settings']['form']['description'],
144 144
     '#rows' => 5,
145 145
     '#description' => t('Instructions to present to the user on the editing form.'),
146 146
     '#required' => FALSE,
147
-  );
148
-  $form['settings']['display'] = array(
147
+    );
148
+    $form['settings']['display'] = array(
149 149
     '#type' => 'fieldset',
150 150
     '#title' => t('Display settings'),
151 151
     '#description' => t('These settings apply to the group on node display.'),
152
-  );
153
-  $form['settings']['display']['description'] = array(
152
+    );
153
+    $form['settings']['display']['description'] = array(
154 154
     '#type' => 'textarea',
155 155
     '#title' => t('Description'),
156 156
     '#default_value' => $group['settings']['display']['description'],
157 157
     '#rows' => 5,
158 158
     '#description' => t('A description of the group.'),
159 159
     '#required' => FALSE,
160
-  );
160
+    );
161 161
 
162
-  foreach (array_keys(content_build_modes()) as $key) {
162
+    foreach (array_keys(content_build_modes()) as $key) {
163 163
     $form['settings']['display'][$key]['format'] = array('#type' => 'value', '#value' => isset($group['settings']['display'][$key]['format']) ? $group['settings']['display'][$key]['format'] : 'fieldset');
164 164
     $form['settings']['display'][$key]['exclude'] = array('#type' => 'value', '#value' => isset($group['settings']['display'][$key]['exclude']) ? $group['settings']['display'][$key]['exclude'] : 0);
165
-  }
166
-  $form['settings']['display']['label'] = array('#type' => 'value', '#value' => $group['settings']['display']['label']);
167
-  $form['weight'] = array('#type' => 'hidden', '#default_value' => $group['weight']);
168
-  $form['group_name'] = array('#type' => 'hidden', '#default_value' => $group_name);
165
+    }
166
+    $form['settings']['display']['label'] = array('#type' => 'value', '#value' => $group['settings']['display']['label']);
167
+    $form['weight'] = array('#type' => 'hidden', '#default_value' => $group['weight']);
168
+    $form['group_name'] = array('#type' => 'hidden', '#default_value' => $group_name);
169 169
 
170
-  $form['#content_type'] = $content_type;
170
+    $form['#content_type'] = $content_type;
171 171
 
172
-  $form['submit'] = array(
172
+    $form['submit'] = array(
173 173
     '#type' => 'submit',
174 174
     '#value' => t('Save'),
175 175
     '#weight' => 10,
176
-  );
176
+    );
177 177
 
178
-  return $form;
178
+    return $form;
179 179
 }
180 180
 
181 181
 function fieldgroup_group_edit_form_submit($form, &$form_state) {
182
-  $form_values = $form_state['values'];
183
-  $content_type = $form['#content_type'];
184
-  fieldgroup_save_group($content_type['type'], $form_values);
185
-  $form_state['redirect'] = 'admin/content/node-type/'. $content_type['url_str'] .'/fields';
182
+    $form_values = $form_state['values'];
183
+    $content_type = $form['#content_type'];
184
+    fieldgroup_save_group($content_type['type'], $form_values);
185
+    $form_state['redirect'] = 'admin/content/node-type/'. $content_type['url_str'] .'/fields';
186 186
 }
187 187
 
188 188
 function fieldgroup_remove_group(&$form_state, $type_name, $group_name) {
189
-  $content_type = content_types($type_name);
190
-  $groups = fieldgroup_groups($content_type['type']);
191
-  $group = isset($groups[$group_name]) ? $groups[$group_name] : '';
189
+    $content_type = content_types($type_name);
190
+    $groups = fieldgroup_groups($content_type['type']);
191
+    $group = isset($groups[$group_name]) ? $groups[$group_name] : '';
192 192
 
193
-  if (empty($group)) {
193
+    if (empty($group)) {
194 194
     drupal_not_found();
195 195
     exit;
196
-  }
196
+    }
197 197
 
198
-  $form['#submit'][] = 'fieldgroup_remove_group_submit';
199
-  $form['#content_type'] = $content_type;
200
-  $form['#group_name'] = $group_name;
198
+    $form['#submit'][] = 'fieldgroup_remove_group_submit';
199
+    $form['#content_type'] = $content_type;
200
+    $form['#group_name'] = $group_name;
201 201
 
202
-  return confirm_form($form,
203
-                  t('Are you sure you want to remove the group %label?',
204
-                  array('%label' => t($group['label']))),
205
-                  'admin/content/node-type/'. $content_type['url_str'] .'/fields', t('This action cannot be undone.'),
206
-                  t('Remove'), t('Cancel'));
202
+    return confirm_form($form,
203
+                    t('Are you sure you want to remove the group %label?',
204
+                    array('%label' => t($group['label']))),
205
+                    'admin/content/node-type/'. $content_type['url_str'] .'/fields', t('This action cannot be undone.'),
206
+                    t('Remove'), t('Cancel'));
207 207
 }
208 208
 
209 209
 function fieldgroup_remove_group_submit($form, &$form_state) {
210
-  $form_values = $form_state['values'];
211
-  $content_type = $form['#content_type'];
212
-  $group_name = $form['#group_name'];
213
-  fieldgroup_delete($content_type['type'], $group_name);
214
-  drupal_set_message(t('The group %group_name has been removed.', array('%group_name' => $group_name)));
215
-  $form_state['redirect'] = 'admin/content/node-type/'. $content_type['url_str'] .'/fields';
210
+    $form_values = $form_state['values'];
211
+    $content_type = $form['#content_type'];
212
+    $group_name = $form['#group_name'];
213
+    fieldgroup_delete($content_type['type'], $group_name);
214
+    drupal_set_message(t('The group %group_name has been removed.', array('%group_name' => $group_name)));
215
+    $form_state['redirect'] = 'admin/content/node-type/'. $content_type['url_str'] .'/fields';
216 216
 }
217 217
 
218 218
 /**
219 219
  * Returns all groups for a content type
220 220
  */
221 221
 function fieldgroup_groups($content_type = '', $sorted = FALSE, $reset = FALSE) {
222
-  global $language;
223
-  static $groups, $groups_sorted;
224
-  if (!isset($groups) || $reset) {
222
+    global $language;
223
+    static $groups, $groups_sorted;
224
+    if (!isset($groups) || $reset) {
225 225
     if ($cached = cache_get('fieldgroup_data:'. $language->language, content_cache_tablename())) {
226
-      $data = $cached->data;
227
-      $groups = $data['groups'];
228
-      $groups_sorted = $data['groups_sorted'];
226
+        $data = $cached->data;
227
+        $groups = $data['groups'];
228
+        $groups_sorted = $data['groups_sorted'];
229 229
     }
230 230
     else {
231
-      $result = db_query("SELECT * FROM {". fieldgroup_tablename() ."} ORDER BY weight, group_name");
232
-      $groups = array();
233
-      $groups_sorted = array();
234
-      while ($group = db_fetch_array($result)) {
231
+        $result = db_query("SELECT * FROM {". fieldgroup_tablename() ."} ORDER BY weight, group_name");
232
+        $groups = array();
233
+        $groups_sorted = array();
234
+        while ($group = db_fetch_array($result)) {
235 235
         $group['settings'] = unserialize($group['settings']);
236 236
         $group['fields'] = array();
237 237
 
238 238
         // Allow external modules to translate field group strings.
239 239
         $group_strings = array(
240
-          'label' => $group['label'],
241
-          'form_description' => $group['settings']['form']['description'],
242
-          'display_description' => $group['settings']['display']['description'],
240
+            'label' => $group['label'],
241
+            'form_description' => $group['settings']['form']['description'],
242
+            'display_description' => $group['settings']['display']['description'],
243 243
         );
244 244
         drupal_alter('content_fieldgroup_strings', $group_strings, $group['type_name'], $group['group_name']);
245 245
         $group['label'] = $group_strings['label'];
@@ -248,58 +248,58 @@  discard block
 block discarded – undo
248 248
 
249 249
         $groups[$group['type_name']][$group['group_name']] = $group;
250 250
         $groups_sorted[$group['type_name']][] = &$groups[$group['type_name']][$group['group_name']];
251
-      }
252
-      //load fields
253
-      $result = db_query("SELECT nfi.*, ng.group_name FROM {". fieldgroup_tablename() ."} ng ".
254
- "INNER JOIN {". fieldgroup_fields_tablename() ."} ngf ON ngf.type_name = ng.type_name AND ngf.group_name = ng.group_name ".
255
- "INNER JOIN {". content_instance_tablename() ."} nfi ON nfi.field_name = ngf.field_name AND nfi.type_name = ngf.type_name ".
256
- "WHERE nfi.widget_active = 1 ORDER BY nfi.weight");
257
-      while ($field = db_fetch_array($result)) {
251
+        }
252
+        //load fields
253
+        $result = db_query("SELECT nfi.*, ng.group_name FROM {". fieldgroup_tablename() ."} ng ".
254
+    "INNER JOIN {". fieldgroup_fields_tablename() ."} ngf ON ngf.type_name = ng.type_name AND ngf.group_name = ng.group_name ".
255
+    "INNER JOIN {". content_instance_tablename() ."} nfi ON nfi.field_name = ngf.field_name AND nfi.type_name = ngf.type_name ".
256
+    "WHERE nfi.widget_active = 1 ORDER BY nfi.weight");
257
+        while ($field = db_fetch_array($result)) {
258 258
         // Allow external modules to translate field strings.
259 259
         $field_strings = array(
260
-          'widget_label' => $field['label'],
261
-          'widget_description' => $field['description'],
260
+            'widget_label' => $field['label'],
261
+            'widget_description' => $field['description'],
262 262
         );
263 263
         drupal_alter('content_field_strings', $field_strings, $field['type_name'], $field['field_name']);
264 264
         $field['label'] = $field_strings['widget_label'];
265 265
         $field['description'] = $field_strings['widget_description'];
266 266
 
267 267
         $groups[$field['type_name']][$field['group_name']]['fields'][$field['field_name']] = $field;
268
-      }
269
-      cache_set('fieldgroup_data:'. $language->language, array('groups' => $groups, 'groups_sorted' => $groups_sorted), content_cache_tablename());
268
+        }
269
+        cache_set('fieldgroup_data:'. $language->language, array('groups' => $groups, 'groups_sorted' => $groups_sorted), content_cache_tablename());
270
+    }
270 271
     }
271
-  }
272
-  if (empty($content_type)) {
272
+    if (empty($content_type)) {
273 273
     return $groups;
274
-  }
275
-  elseif (empty($groups) || empty($groups[$content_type])) {
274
+    }
275
+    elseif (empty($groups) || empty($groups[$content_type])) {
276 276
     return array();
277
-  }
278
-  return $sorted ? $groups_sorted[$content_type] : $groups[$content_type];
277
+    }
278
+    return $sorted ? $groups_sorted[$content_type] : $groups[$content_type];
279 279
 }
280 280
 
281 281
 
282 282
 function _fieldgroup_groups_label($content_type) {
283
-  $groups = fieldgroup_groups($content_type);
283
+    $groups = fieldgroup_groups($content_type);
284 284
 
285
-  $labels[''] = '<'. t('none') .'>';
286
-  foreach ($groups as $group_name => $group) {
285
+    $labels[''] = '<'. t('none') .'>';
286
+    foreach ($groups as $group_name => $group) {
287 287
     $labels[$group_name] = t($group['label']);
288
-  }
289
-  return $labels;
288
+    }
289
+    return $labels;
290 290
 }
291 291
 
292 292
 function _fieldgroup_field_get_group($content_type, $field_name) {
293
-  return db_result(db_query("SELECT group_name FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $content_type, $field_name));
293
+    return db_result(db_query("SELECT group_name FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $content_type, $field_name));
294 294
 }
295 295
 
296 296
 /**
297 297
  * Implementation of hook_form_alter()
298 298
  */
299 299
 function fieldgroup_form_alter(&$form, $form_state, $form_id) {
300
-  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
300
+    if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
301 301
     foreach (fieldgroup_groups($form['type']['#value']) as $group_name => $group) {
302
-      $form[$group_name] = array(
302
+        $form[$group_name] = array(
303 303
         '#type' => 'fieldset',
304 304
         '#title' => check_plain(t($group['label'])),
305 305
         '#collapsed' => $group['settings']['form']['style'] == 'fieldset_collapsed',
@@ -307,62 +307,62 @@  discard block
 block discarded – undo
307 307
         '#weight' => $group['weight'],
308 308
         '#description' => content_filter_xss(t($group['settings']['form']['description'])),
309 309
         '#attributes' => array('class' => strtr($group['group_name'], '_', '-')),
310
-      );
310
+        );
311 311
 
312
-      $has_accessible_field = FALSE;
313
-      foreach ($group['fields'] as $field_name => $field) {
312
+        $has_accessible_field = FALSE;
313
+        foreach ($group['fields'] as $field_name => $field) {
314 314
         if (isset($form[$field_name])) {
315
-          $form[$group_name][$field_name] = $form[$field_name];
316
-          // Track whether this group has any accessible fields within it.
317
-          if (!isset($form[$field_name]['#access']) || $form[$field_name]['#access'] !== FALSE) {
315
+            $form[$group_name][$field_name] = $form[$field_name];
316
+            // Track whether this group has any accessible fields within it.
317
+            if (!isset($form[$field_name]['#access']) || $form[$field_name]['#access'] !== FALSE) {
318 318
             $has_accessible_field = TRUE;
319
-          }
320
-          unset($form[$field_name]);
319
+            }
320
+            unset($form[$field_name]);
321
+        }
321 322
         }
322
-      }
323
-      if (!empty($group['fields']) && !element_children($form[$group_name])) {
323
+        if (!empty($group['fields']) && !element_children($form[$group_name])) {
324 324
         //hide the fieldgroup, because the fields are hidden too
325 325
         unset($form[$group_name]);
326
-      }
326
+        }
327 327
 
328
-      if (!$has_accessible_field) {
328
+        if (!$has_accessible_field) {
329 329
         // Hide the fieldgroup, because the fields are inaccessible.
330 330
         $form[$group_name]['#access'] = FALSE;
331
-      }
331
+        }
332 332
 
333
-      // Allow other modules to alter the form.
334
-      // Can't use module_invoke_all because we want
335
-      // to be able to use a reference to $form and $form_state.
336
-      foreach (module_implements('fieldgroup_form') as $module) {
333
+        // Allow other modules to alter the form.
334
+        // Can't use module_invoke_all because we want
335
+        // to be able to use a reference to $form and $form_state.
336
+        foreach (module_implements('fieldgroup_form') as $module) {
337 337
         $function = $module .'_fieldgroup_form';
338 338
         $function($form, $form_state, $form_id, $group);
339
-      }
339
+        }
340 340
 
341 341
     }
342 342
 
343
-  }
344
-  // The group is only added here so it will appear in the export
345
-  // when using Content Copy.
346
-  elseif ($form_id == 'content_field_edit_form' && isset($form['widget'])) {
343
+    }
344
+    // The group is only added here so it will appear in the export
345
+    // when using Content Copy.
346
+    elseif ($form_id == 'content_field_edit_form' && isset($form['widget'])) {
347 347
     $content_type = content_types($form['type_name']['#value']);
348 348
     $form['widget']['group'] = array(
349
-      '#type' => 'value',
350
-      '#value' => _fieldgroup_field_get_group($content_type['type'], $form['field_name']['#value']),
349
+        '#type' => 'value',
350
+        '#value' => _fieldgroup_field_get_group($content_type['type'], $form['field_name']['#value']),
351 351
     );
352
-  }
353
-  elseif ($form_id == 'content_field_overview_form') {
352
+    }
353
+    elseif ($form_id == 'content_field_overview_form') {
354 354
     $form['#validate'][] = 'fieldgroup_field_overview_form_validate';
355 355
     $form['#submit'][] = 'fieldgroup_field_overview_form_submit';
356
-  }
357
-  elseif ($form_id == 'content_display_overview_form' && !empty($form['#groups'])) {
356
+    }
357
+    elseif ($form_id == 'content_display_overview_form' && !empty($form['#groups'])) {
358 358
     $form['#submit'][] = 'fieldgroup_display_overview_form_submit';
359 359
     if (!isset($form['submit'])) {
360
-      $form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 10);
360
+        $form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 10);
361 361
     }
362
-  }
363
-  elseif ($form_id == 'content_field_remove_form') {
362
+    }
363
+    elseif ($form_id == 'content_field_remove_form') {
364 364
     $form['#submit'][] = 'fieldgroup_field_remove_form_submit';
365
-  }
365
+    }
366 366
 }
367 367
 
368 368
 /**
@@ -371,185 +371,185 @@  discard block
 block discarded – undo
371 371
  * Pulled into separate function to be re-usable.
372 372
  */
373 373
 function fieldgroup_validate_name($group, $type_name) {
374
-  $errors = array();
374
+    $errors = array();
375 375
 
376
-  // No label.
377
-  if (!$group['label']) {
376
+    // No label.
377
+    if (!$group['label']) {
378 378
     $errors['label'][] = t('You need to provide a label.');
379
-  }
379
+    }
380 380
 
381
-  // No group name.
382
-  if (!$group['group_name']) {
381
+    // No group name.
382
+    if (!$group['group_name']) {
383 383
     $errors['group_name'][] = t('You need to provide a group name.');
384
-  }
385
-  // Group name validation.
386
-  else {
384
+    }
385
+    // Group name validation.
386
+    else {
387 387
     $group_name = $group['group_name'];
388 388
     $group['group_type'] = !empty($group['group_type']) ? $group['group_type'] : 'standard';
389 389
 
390 390
     // Add the 'group_' prefix.
391 391
     if (substr($group_name, 0, 6) != 'group_') {
392
-      $group_name = 'group_'. $group_name;
392
+        $group_name = 'group_'. $group_name;
393 393
     }
394 394
 
395 395
     // Invalid field name.
396 396
     if (!preg_match('!^group_[a-z0-9_]+$!', $group_name)) {
397
-      $errors['group_name'][] = t('The group name %group_name is invalid. The name must include only lowercase unaccentuated letters, numbers, and underscores.', array('%group_name' => $group_name));
397
+        $errors['group_name'][] = t('The group name %group_name is invalid. The name must include only lowercase unaccentuated letters, numbers, and underscores.', array('%group_name' => $group_name));
398 398
     }
399 399
     if (strlen($group_name) > 32) {
400
-      $errors['group_name'][] = t('The group name %group_name is too long. The name is limited to 32 characters, including the \'group_\' prefix.', array('%group_name' => $group_name));
400
+        $errors['group_name'][] = t('The group name %group_name is too long. The name is limited to 32 characters, including the \'group_\' prefix.', array('%group_name' => $group_name));
401 401
     }
402 402
 
403 403
     // Group name already exists.
404 404
     $groups = fieldgroup_groups($type_name);
405 405
     if (isset($groups[$group_name])) {
406
-      $errors['group_name'][] = t('The group name %group_name already exists.', array('%group_name' => $group_name));
406
+        $errors['group_name'][] = t('The group name %group_name already exists.', array('%group_name' => $group_name));
407 407
     }
408 408
     if (empty($errors['group_name'])) {
409
-      $group['group_name'] = $group_name;
409
+        $group['group_name'] = $group_name;
410
+    }
410 411
     }
411
-  }
412
-  return array('group_name' => $group['group_name'], 'errors' => $errors);
412
+    return array('group_name' => $group['group_name'], 'errors' => $errors);
413 413
 }
414 414
 
415 415
 function fieldgroup_field_overview_form_validate($form, &$form_state) {
416
-  $form_values = $form_state['values'];
417
-  $group = $form_values['_add_new_group'];
416
+    $form_values = $form_state['values'];
417
+    $group = $form_values['_add_new_group'];
418 418
 
419
-  if (array_filter(array($group['label'], $group['group_name']))) {
419
+    if (array_filter(array($group['label'], $group['group_name']))) {
420 420
     $validation = fieldgroup_validate_name($group, $form['#type_name']);
421 421
     if (!empty($validation['errors'])) {
422
-      foreach ($validation['errors'] as $type => $messages) {
422
+        foreach ($validation['errors'] as $type => $messages) {
423 423
         foreach ($messages as $message) {
424
-          if ($type == 'label') {
424
+            if ($type == 'label') {
425 425
             form_set_error('_add_new_group][label', t('Add new group:') .' '. $message);
426
-          }
427
-          else {
426
+            }
427
+            else {
428 428
             form_set_error('_add_new_group][group_name', t('Add new group:') .' '. $message);
429
-          }
429
+            }
430
+        }
430 431
         }
431
-      }
432 432
     }
433 433
     $group_name = $validation['group_name'];
434 434
     form_set_value($form['_add_new_group']['group_name'], $group_name, $form_state);
435
-  }
436
-  else {
435
+    }
436
+    else {
437 437
     // Fail validation if attempt to nest fields under a new group without the
438 438
     // proper information. Not raising an error would cause the nested fields
439 439
     // to get weights the user doesn't expect.
440 440
 
441 441
     foreach ($form_values as $key => $values) {
442
-      if ($values['parent'] == '_add_new_group') {
442
+        if ($values['parent'] == '_add_new_group') {
443 443
         form_set_error('_add_new_group][label', t('Add new group: you need to provide a label.'));
444 444
         form_set_error('_add_new_group][group_name', t('Add new group: you need to provide a group name.'));
445 445
         break;
446
-      }
446
+        }
447
+    }
447 448
     }
448
-  }
449 449
 }
450 450
 
451 451
 function fieldgroup_field_overview_form_submit($form, &$form_state) {
452
-  $form_values = $form_state['values'];
453
-  $type_name = $form['#type_name'];
452
+    $form_values = $form_state['values'];
453
+    $type_name = $form['#type_name'];
454 454
 
455
-  // Create new group if needed.
456
-  if (!empty($form_values['_add_new_group']['label'])) {
455
+    // Create new group if needed.
456
+    if (!empty($form_values['_add_new_group']['label'])) {
457 457
     $group = $form_values['_add_new_group'];
458 458
     $group['settings'] = field_group_default_settings($group['group_type']);
459 459
     fieldgroup_save_group($type_name, $group);
460 460
     $new_group_name = $group['group_name'];
461
-  }
461
+    }
462 462
 
463
-  // Parse incoming rows.
464
-  $add_field_rows = array('_add_new_field', '_add_existing_field');
465
-  $field_rows = array_merge($form['#fields'], $add_field_rows);
466
-  foreach ($form_values as $key => $values) {
463
+    // Parse incoming rows.
464
+    $add_field_rows = array('_add_new_field', '_add_existing_field');
465
+    $field_rows = array_merge($form['#fields'], $add_field_rows);
466
+    foreach ($form_values as $key => $values) {
467 467
     // If 'field' row: update field parenting.
468 468
     if (in_array($key, $field_rows)) {
469
-      // If newly added fields were added to a group:
470
-      if (in_array($key, $add_field_rows)) {
469
+        // If newly added fields were added to a group:
470
+        if (in_array($key, $add_field_rows)) {
471 471
         // We replace the '_add_*_field' key with the actual name of
472 472
         // the field that got added.
473 473
         // content_field_overview_form_submit() placed those
474 474
         // in $form_state['fields_added'] for us.
475 475
         if (isset($form_state['fields_added'][$key])) {
476
-          $key = $form_state['fields_added'][$key];
476
+            $key = $form_state['fields_added'][$key];
477 477
         }
478 478
         else {
479
-          // No field was actually created : skip to next row.
480
-          continue;
479
+            // No field was actually created : skip to next row.
480
+            continue;
481 481
         }
482
-      }
483
-      // If the field was added to the newly created group, replace the
484
-      // '_add_new_group' value with the actual name of the group.
485
-      $parent = ($values['parent'] == '_add_new_group' && isset($new_group_name)) ? $new_group_name : $values['parent'];
486
-      // TODO: check the parent group does exist ?
487
-      fieldgroup_update_fields(array('field_name' => $key, 'group' => $parent, 'type_name' => $type_name));
482
+        }
483
+        // If the field was added to the newly created group, replace the
484
+        // '_add_new_group' value with the actual name of the group.
485
+        $parent = ($values['parent'] == '_add_new_group' && isset($new_group_name)) ? $new_group_name : $values['parent'];
486
+        // TODO: check the parent group does exist ?
487
+        fieldgroup_update_fields(array('field_name' => $key, 'group' => $parent, 'type_name' => $type_name));
488 488
     }
489 489
 
490 490
     // If 'group' row:  update groups weights
491 491
     // (possible newly created group has already been taken care of).
492 492
     elseif (in_array($key, $form['#groups'])) {
493
-      db_query("UPDATE {". fieldgroup_tablename() ."} SET weight = %d WHERE type_name = '%s' AND group_name = '%s'",
493
+        db_query("UPDATE {". fieldgroup_tablename() ."} SET weight = %d WHERE type_name = '%s' AND group_name = '%s'",
494 494
         $values['weight'], $type_name, $key);
495 495
     }
496
-  }
496
+    }
497 497
 
498
-  cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
498
+    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
499 499
 }
500 500
 
501 501
 function field_group_default_settings($group_type) {
502
-  $settings = array(
502
+    $settings = array(
503 503
     'form' => array('style' => 'fieldset', 'description' => ''),
504 504
     'display' => array('description' => '', 'label' => 'above'),
505
-  );
506
-  module_load_include('inc', 'content', 'includes/content.admin');
507
-  foreach (array_keys(content_build_modes()) as $key) {
505
+    );
506
+    module_load_include('inc', 'content', 'includes/content.admin');
507
+    foreach (array_keys(content_build_modes()) as $key) {
508 508
     $settings['display'][$key]['format'] = 'fieldset';
509 509
     $settings['display'][$key]['exclude'] = 0;
510
-  }
511
-  // Allow other modules to add new default settings.
512
-  $settings = array_merge($settings, module_invoke_all('fieldgroup_default_settings', $group_type));
513
-  return $settings;
510
+    }
511
+    // Allow other modules to add new default settings.
512
+    $settings = array_merge($settings, module_invoke_all('fieldgroup_default_settings', $group_type));
513
+    return $settings;
514 514
 }
515 515
 
516 516
 function fieldgroup_display_overview_form_submit($form, &$form_state) {
517
-  $form_values = $form_state['values'];
518
-  $groups = fieldgroup_groups($form['#type_name']);
519
-  foreach ($form_values as $key => $values) {
517
+    $form_values = $form_state['values'];
518
+    $groups = fieldgroup_groups($form['#type_name']);
519
+    foreach ($form_values as $key => $values) {
520 520
     if (in_array($key, $form['#groups'])) {
521
-      $group = $groups[$key];
522
-      // We have some numeric keys here, so we can't use array_merge.
523
-      $group['settings']['display'] = $values + $group['settings']['display'];
524
-      fieldgroup_save_group($form['#type_name'], $group);
521
+        $group = $groups[$key];
522
+        // We have some numeric keys here, so we can't use array_merge.
523
+        $group['settings']['display'] = $values + $group['settings']['display'];
524
+        fieldgroup_save_group($form['#type_name'], $group);
525
+    }
525 526
     }
526
-  }
527 527
 }
528 528
 
529 529
 function fieldgroup_field_remove_form_submit($form, &$form_state) {
530
-  $form_values = $form_state['values'];
531
-  // TODO:
532
-  // - when a (non last) field is removed from a group, a 'ghost row' remains in the fields overview
533
-  // - when the last field is removed, the group disappears
534
-  // seems to be fixed when emptying the cache.
535
-  db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
530
+    $form_values = $form_state['values'];
531
+    // TODO:
532
+    // - when a (non last) field is removed from a group, a 'ghost row' remains in the fields overview
533
+    // - when the last field is removed, the group disappears
534
+    // seems to be fixed when emptying the cache.
535
+    db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
536 536
 }
537 537
 
538 538
 /**
539 539
  * Implementation of hook_nodeapi().
540 540
  */
541 541
 function fieldgroup_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
542
-  switch ($op) {
542
+    switch ($op) {
543 543
     case 'view':
544 544
       // Prevent against invalid 'nodes' built by broken 3rd party code.
545 545
       if (isset($node->type)) {
546 546
         // Build the node content element needed to render each fieldgroup.
547 547
         foreach (fieldgroup_groups($node->type) as $group) {
548
-          fieldgroup_build_content($group, $node, $teaser, $page);
548
+            fieldgroup_build_content($group, $node, $teaser, $page);
549
+        }
549 550
         }
550
-      }
551
-      break;
552
-  }
551
+        break;
552
+    }
553 553
 }
554 554
 
555 555
 /**
@@ -569,80 +569,80 @@  discard block
 block discarded – undo
569 569
  * @see fieldgroup_view_group()
570 570
  */
571 571
 function fieldgroup_build_content($group, &$node, $teaser, $page) {
572
-  // NODE_BUILD_NORMAL is 0, and ('whatever' == 0) is TRUE, so we need a ===.
573
-  if ($node->build_mode === NODE_BUILD_NORMAL || $node->build_mode == NODE_BUILD_PREVIEW) {
572
+    // NODE_BUILD_NORMAL is 0, and ('whatever' == 0) is TRUE, so we need a ===.
573
+    if ($node->build_mode === NODE_BUILD_NORMAL || $node->build_mode == NODE_BUILD_PREVIEW) {
574 574
     $context = $teaser ? 'teaser' : 'full';
575
-  }
576
-  else {
575
+    }
576
+    else {
577 577
     $context = $node->build_mode;
578
-  }
578
+    }
579 579
 
580
-  $group_name = $group['group_name'];
580
+    $group_name = $group['group_name'];
581 581
 
582
-  // Do not include group labels when indexing content.
583
-  if ($context == NODE_BUILD_SEARCH_INDEX) {
582
+    // Do not include group labels when indexing content.
583
+    if ($context == NODE_BUILD_SEARCH_INDEX) {
584 584
     $group['settings']['display']['label'] = 'hidden';
585
-  }
586
-  $label = $group['settings']['display']['label'] == 'above';
587
-  $element = array(
585
+    }
586
+    $label = $group['settings']['display']['label'] == 'above';
587
+    $element = array(
588 588
     '#title' => $label ? check_plain(t($group['label'])) : '',
589 589
     '#description' => $label ? content_filter_xss(t($group['settings']['display']['description'])) : '',
590
-  );
591
-  $format = isset($group['settings']['display'][$context]['format']) ? $group['settings']['display'][$context]['format'] : 'fieldset';
590
+    );
591
+    $format = isset($group['settings']['display'][$context]['format']) ? $group['settings']['display'][$context]['format'] : 'fieldset';
592 592
 
593
-  switch ($format) {
593
+    switch ($format) {
594 594
     case 'simple':
595 595
       $element['#type'] = 'fieldgroup_simple';
596
-      $element['#group_name'] = $group_name;
597
-      $element['#node'] = $node;
598
-      break;
596
+        $element['#group_name'] = $group_name;
597
+        $element['#node'] = $node;
598
+        break;
599 599
     case 'hidden':
600 600
       $element['#access'] = FALSE;
601
-      break;
601
+        break;
602 602
     case 'fieldset_collapsed':
603 603
       $element['#collapsed'] = TRUE;
604 604
     case 'fieldset_collapsible':
605 605
       $element['#collapsible'] = TRUE;
606 606
     case 'fieldset':
607 607
       $element['#type'] = 'fieldgroup_fieldset';
608
-      $element['#attributes'] = array('class' => 'fieldgroup '. strtr($group['group_name'], '_', '-'));
609
-      break;
610
-  }
611
-  foreach ($group['fields'] as $field_name => $field) {
608
+        $element['#attributes'] = array('class' => 'fieldgroup '. strtr($group['group_name'], '_', '-'));
609
+        break;
610
+    }
611
+    foreach ($group['fields'] as $field_name => $field) {
612 612
     if (isset($node->content[$field_name])) {
613
-      $element[$field_name] = $node->content[$field_name];
613
+        $element[$field_name] = $node->content[$field_name];
614
+    }
614 615
     }
615
-  }
616 616
 
617
-  // Allow other modules to alter the group view.
618
-  // Can't use module_invoke_all because we want
619
-  // to be able to use a reference to $node and $element.
620
-  foreach (module_implements('fieldgroup_view') as $module) {
617
+    // Allow other modules to alter the group view.
618
+    // Can't use module_invoke_all because we want
619
+    // to be able to use a reference to $node and $element.
620
+    foreach (module_implements('fieldgroup_view') as $module) {
621 621
     $function = $module .'_fieldgroup_view';
622 622
     $function($node, $element, $group, $context);
623
-  }
623
+    }
624 624
 
625
-  // Unset the original field values now that we've moved them.
626
-  foreach ($group['fields'] as $field_name => $field) {
625
+    // Unset the original field values now that we've moved them.
626
+    foreach ($group['fields'] as $field_name => $field) {
627 627
     if (isset($node->content[$field_name])) {
628
-      unset($node->content[$field_name]);
628
+        unset($node->content[$field_name]);
629
+    }
629 630
     }
630
-  }
631 631
 
632
-  // The wrapper lets us get the themed output for the group
633
-  // to populate the $GROUP_NAME_rendered variable for node templates,
634
-  // and hide it from the $content variable if needed.
635
-  // See fieldgroup_preprocess_node(), theme_fieldgroup_wrapper().
636
-  $wrapper = array(
632
+    // The wrapper lets us get the themed output for the group
633
+    // to populate the $GROUP_NAME_rendered variable for node templates,
634
+    // and hide it from the $content variable if needed.
635
+    // See fieldgroup_preprocess_node(), theme_fieldgroup_wrapper().
636
+    $wrapper = array(
637 637
     'group' => $element,
638 638
     '#weight' => $group['weight'],
639 639
     '#post_render' => array('fieldgroup_wrapper_post_render'),
640 640
     '#group_name' => $group_name,
641 641
     '#type_name' => $node->type,
642 642
     '#context' => $context,
643
-  );
643
+    );
644 644
 
645
-  $node->content[$group_name] = $wrapper;
645
+    $node->content[$group_name] = $wrapper;
646 646
 }
647 647
 
648 648
 /**
@@ -674,64 +674,64 @@  discard block
 block discarded – undo
674 674
  * @see content_view_field()
675 675
  */
676 676
 function fieldgroup_view_group($group, &$node, $teaser = FALSE, $page = FALSE) {
677
-  $group_name = $group['group_name'];
678
-  $field_types = _content_field_types();
677
+    $group_name = $group['group_name'];
678
+    $field_types = _content_field_types();
679 679
 
680
-  // Clone the node to prevent from altering the original.
681
-  $node_copy = drupal_clone($node);
680
+    // Clone the node to prevent from altering the original.
681
+    $node_copy = drupal_clone($node);
682 682
 
683
-  // Use 'full'/'teaser' if not specified otherwise.
684
-  $node_copy->build_mode = isset($node_copy->build_mode) ? $node_copy->build_mode : NODE_BUILD_NORMAL;
683
+    // Use 'full'/'teaser' if not specified otherwise.
684
+    $node_copy->build_mode = isset($node_copy->build_mode) ? $node_copy->build_mode : NODE_BUILD_NORMAL;
685 685
 
686
-  // Build the content element for individual fields in the field group.
687
-  if (!isset($node_copy->content)) {
686
+    // Build the content element for individual fields in the field group.
687
+    if (!isset($node_copy->content)) {
688 688
     $node_copy->content = array();
689
-  }
690
-  foreach (array_keys($group['fields']) as $field_name) {
689
+    }
690
+    foreach (array_keys($group['fields']) as $field_name) {
691 691
     $field = content_fields($field_name, $node_copy->type);
692 692
 
693 693
     if (isset($node_copy->{$field_name})) {
694
-      $items = $node_copy->{$field_name};
694
+        $items = $node_copy->{$field_name};
695 695
 
696
-      // One-field equivalent to _content_field_invoke('sanitize').
697
-      $module = $field_types[$field['type']]['module'];
698
-      $function = $module .'_field';
699
-      if (function_exists($function)) {
696
+        // One-field equivalent to _content_field_invoke('sanitize').
697
+        $module = $field_types[$field['type']]['module'];
698
+        $function = $module .'_field';
699
+        if (function_exists($function)) {
700 700
         $function('sanitize', $node_copy, $field, $items, $teaser, $page);
701 701
         $node_copy->{$field_name} = $items;
702
-      }
702
+        }
703 703
 
704
-      $field_view = content_field('view', $node_copy, $field, $items, $teaser, $page);
705
-      // content_field('view') adds a wrapper to handle variables and 'excluded'
706
-      // fields for node templates. We bypass it and get the actual field.
707
-      $node_copy->content[$field_name] = $field_view[$field_name];
704
+        $field_view = content_field('view', $node_copy, $field, $items, $teaser, $page);
705
+        // content_field('view') adds a wrapper to handle variables and 'excluded'
706
+        // fields for node templates. We bypass it and get the actual field.
707
+        $node_copy->content[$field_name] = $field_view[$field_name];
708
+    }
708 709
     }
709
-  }
710 710
 
711
-  // Build the content element of the field group itself.
712
-  fieldgroup_build_content($group, $node_copy, $teaser, $page);
711
+    // Build the content element of the field group itself.
712
+    fieldgroup_build_content($group, $node_copy, $teaser, $page);
713 713
 
714
-  // fieldgroup_build_content() adds a wrapper to handle variables and 'excluded'
715
-  // groups for node templates. We bypass it and render the actual field group.
716
-  $output = drupal_render($node_copy->content[$group_name]['group']);
714
+    // fieldgroup_build_content() adds a wrapper to handle variables and 'excluded'
715
+    // groups for node templates. We bypass it and render the actual field group.
716
+    $output = drupal_render($node_copy->content[$group_name]['group']);
717 717
 
718
-  return $output;
718
+    return $output;
719 719
 }
720 720
 
721 721
 /**
722 722
  * Hide specified fields from the $content variable in node templates.
723 723
  */
724 724
 function fieldgroup_wrapper_post_render($content, $element) {
725
-  $groups = fieldgroup_groups($element['#type_name']);
726
-  $group = $groups[$element['#group_name']];
725
+    $groups = fieldgroup_groups($element['#type_name']);
726
+    $group = $groups[$element['#group_name']];
727 727
 
728
-  // The display settings are not in quite the same place in the
729
-  // group and the field, so create the value the theme will expect.
730
-  $group['display_settings'] = $group['settings']['display'];
731
-  if (theme('content_exclude', $content, $group, $element['#context'])) {
728
+    // The display settings are not in quite the same place in the
729
+    // group and the field, so create the value the theme will expect.
730
+    $group['display_settings'] = $group['settings']['display'];
731
+    if (theme('content_exclude', $content, $group, $element['#context'])) {
732 732
     return '';
733
-  }
734
-  return $content;
733
+    }
734
+    return $content;
735 735
 }
736 736
 
737 737
 /*
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
  * @return The name of the group, or FALSE.
741 741
  */
742 742
 function fieldgroup_get_group($content_type, $field_name) {
743
-  foreach (fieldgroup_groups($content_type) as $group_name => $group) {
743
+    foreach (fieldgroup_groups($content_type) as $group_name => $group) {
744 744
     if (in_array($field_name, array_keys($group['fields']))) {
745
-      return $group_name;
745
+        return $group_name;
746 746
     }
747
-  }
748
-  return FALSE;
747
+    }
748
+    return FALSE;
749 749
 }
750 750
 
751 751
 /**
@@ -753,37 +753,37 @@  discard block
 block discarded – undo
753 753
  *  React to change in node types
754 754
  */
755 755
 function fieldgroup_node_type($op, $info) {
756
-  if ($op == 'update' && !empty($info->old_type) && $info->type != $info->old_type) {
756
+    if ($op == 'update' && !empty($info->old_type) && $info->type != $info->old_type) {
757 757
     // update the tables
758 758
     db_query("UPDATE {". fieldgroup_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
759 759
     db_query("UPDATE {". fieldgroup_fields_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
760 760
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
761
-  }
762
-  elseif ($op == 'delete') {
761
+    }
762
+    elseif ($op == 'delete') {
763 763
     db_query("DELETE FROM {". fieldgroup_tablename() ."} WHERE type_name = '%s'", $info->type);
764 764
     db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s'", $info->type);
765
-  }
765
+    }
766 766
 }
767 767
 
768 768
 function fieldgroup_types() {
769
-  $types = array('standard' => t('Standard group'));
770
-  // Allow other modules to add new group_types.
771
-  $types = array_merge($types, module_invoke_all('fieldgroup_types'));
772
-  return $types;
769
+    $types = array('standard' => t('Standard group'));
770
+    // Allow other modules to add new group_types.
771
+    $types = array_merge($types, module_invoke_all('fieldgroup_types'));
772
+    return $types;
773 773
 }
774 774
 
775 775
 function fieldgroup_tablename($version = NULL) {
776
-  if (is_null($version)) {
776
+    if (is_null($version)) {
777 777
     $version = variable_get('fieldgroup_schema_version', 0);
778
-  }
779
-  return $version < 6000 ? 'node_group' : 'content_group';
778
+    }
779
+    return $version < 6000 ? 'node_group' : 'content_group';
780 780
 }
781 781
 
782 782
 function fieldgroup_fields_tablename($version = NULL) {
783
-  if (is_null($version)) {
783
+    if (is_null($version)) {
784 784
     $version = variable_get('fieldgroup_schema_version', 0);
785
-  }
786
-  return $version < 6000 ? 'node_group_fields' : 'content_group_fields';
785
+    }
786
+    return $version < 6000 ? 'node_group_fields' : 'content_group_fields';
787 787
 }
788 788
 
789 789
 /**
@@ -796,51 +796,51 @@  discard block
 block discarded – undo
796 796
  * Saves the given group for this content-type
797 797
  */
798 798
 function fieldgroup_save_group($type_name, $group) {
799
-  $groups = fieldgroup_groups($type_name);
799
+    $groups = fieldgroup_groups($type_name);
800 800
 
801
-  // Allow other modules to intervene when the group is saved.
802
-  foreach (module_implements('fieldgroup_save_group') as $module) {
801
+    // Allow other modules to intervene when the group is saved.
802
+    foreach (module_implements('fieldgroup_save_group') as $module) {
803 803
     $function = $module .'_fieldgroup_save_group';
804 804
     $function($group);
805
-  }
805
+    }
806 806
 
807
-  if (!isset($groups[$group['group_name']])) {
807
+    if (!isset($groups[$group['group_name']])) {
808 808
     // Accept group name from programmed submissions if valid.
809 809
     db_query("INSERT INTO {". fieldgroup_tablename() ."} (group_type, type_name, group_name, label, settings, weight)".
810
-      " VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $group['group_type'], $type_name, $group['group_name'], $group['label'], serialize($group['settings']), $group['weight']);
810
+        " VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $group['group_type'], $type_name, $group['group_name'], $group['label'], serialize($group['settings']), $group['weight']);
811 811
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
812 812
     return SAVED_NEW;
813
-  }
814
-  else {
813
+    }
814
+    else {
815 815
     db_query("UPDATE {". fieldgroup_tablename() ."} SET group_type = '%s', label = '%s', settings = '%s', weight = %d ".
816
-             "WHERE type_name = '%s' AND group_name = '%s'",
817
-             $group['group_type'], $group['label'], serialize($group['settings']), $group['weight'], $type_name, $group['group_name']);
816
+                "WHERE type_name = '%s' AND group_name = '%s'",
817
+                $group['group_type'], $group['label'], serialize($group['settings']), $group['weight'], $type_name, $group['group_name']);
818 818
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
819 819
     return SAVED_UPDATED;
820
-  }
820
+    }
821 821
 }
822 822
 
823 823
 function fieldgroup_update_fields($form_values) {
824
-  $default = _fieldgroup_field_get_group($form_values['type_name'], $form_values['field_name']);
824
+    $default = _fieldgroup_field_get_group($form_values['type_name'], $form_values['field_name']);
825 825
 
826
-  if ($default != $form_values['group']) {
826
+    if ($default != $form_values['group']) {
827 827
     if ($form_values['group'] && !$default) {
828
-      db_query("INSERT INTO {". fieldgroup_fields_tablename() ."} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')", $form_values['type_name'], $form_values['group'], $form_values['field_name']);
828
+        db_query("INSERT INTO {". fieldgroup_fields_tablename() ."} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')", $form_values['type_name'], $form_values['group'], $form_values['field_name']);
829 829
     }
830 830
     elseif ($form_values['group']) {
831
-      db_query("UPDATE {". fieldgroup_fields_tablename() ."} SET group_name = '%s' WHERE type_name = '%s' AND field_name = '%s'", $form_values['group'], $form_values['type_name'], $form_values['field_name']);
831
+        db_query("UPDATE {". fieldgroup_fields_tablename() ."} SET group_name = '%s' WHERE type_name = '%s' AND field_name = '%s'", $form_values['group'], $form_values['type_name'], $form_values['field_name']);
832 832
     }
833 833
     else {
834
-      db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
834
+        db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
835 835
     }
836 836
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
837
-  }
837
+    }
838 838
 }
839 839
 
840 840
 function fieldgroup_delete($content_type, $group_name) {
841
-  db_query("DELETE FROM {". fieldgroup_tablename() ."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
842
-  db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
843
-  cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
841
+    db_query("DELETE FROM {". fieldgroup_tablename() ."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
842
+    db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
843
+    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
844 844
 }
845 845
 
846 846
 /**
@@ -849,23 +849,23 @@  discard block
 block discarded – undo
849 849
  * Derived from core's theme_fieldset, with no output if the content is empty.
850 850
  */
851 851
 function theme_fieldgroup_fieldset($element) {
852
-  if (empty($element['#children']) && empty($element['#value'])) {
852
+    if (empty($element['#children']) && empty($element['#value'])) {
853 853
     return '';
854
-  }
854
+    }
855 855
 
856
-  if ($element['#collapsible']) {
856
+    if ($element['#collapsible']) {
857 857
     drupal_add_js('misc/collapse.js');
858 858
 
859 859
     if (!isset($element['#attributes']['class'])) {
860
-      $element['#attributes']['class'] = '';
860
+        $element['#attributes']['class'] = '';
861 861
     }
862 862
 
863 863
     $element['#attributes']['class'] .= ' collapsible';
864 864
     if ($element['#collapsed']) {
865
-      $element['#attributes']['class'] .= ' collapsed';
865
+        $element['#attributes']['class'] .= ' collapsed';
866
+    }
866 867
     }
867
-  }
868
-  return '<fieldset'. drupal_attributes($element['#attributes']) .'>'. ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . (isset($element['#description']) && $element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . (!empty($element['#children']) ? $element['#children'] : '') . (isset($element['#value']) ? $element['#value'] : '') ."</fieldset>\n";
868
+    return '<fieldset'. drupal_attributes($element['#attributes']) .'>'. ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . (isset($element['#description']) && $element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . (!empty($element['#children']) ? $element['#children'] : '') . (isset($element['#value']) ? $element['#value'] : '') ."</fieldset>\n";
869 869
 }
870 870
 
871 871
 
@@ -882,19 +882,19 @@  discard block
 block discarded – undo
882 882
  * @see fieldgroup-simple.tpl.php
883 883
  */
884 884
 function template_preprocess_fieldgroup_simple(&$vars) {
885
-  $element = $vars['element'];
886
-
887
-  $vars['group_name'] = $element['#group_name'];
888
-  $vars['group_name_css'] = strtr($element['#group_name'], '_', '-');
889
-  $vars['label'] = isset($element['#title']) ? $element['#title'] : '';;
890
-  $vars['description'] = isset($element['#description']) ? $element['#description'] : '';;
891
-  $vars['content'] = isset($element['#children']) ? $element['#children'] : '';
892
-  $vars['template_files'] = array(
885
+    $element = $vars['element'];
886
+
887
+    $vars['group_name'] = $element['#group_name'];
888
+    $vars['group_name_css'] = strtr($element['#group_name'], '_', '-');
889
+    $vars['label'] = isset($element['#title']) ? $element['#title'] : '';;
890
+    $vars['description'] = isset($element['#description']) ? $element['#description'] : '';;
891
+    $vars['content'] = isset($element['#children']) ? $element['#children'] : '';
892
+    $vars['template_files'] = array(
893 893
     'fieldgroup-simple-',
894 894
     'fieldgroup-simple-'. $element['#group_name'],
895 895
     'fieldgroup-simple-'. $element['#node']->type,
896 896
     'fieldgroup-simple-'. $element['#group_name'] .'-'. $element['#node']->type,
897
-  );
897
+    );
898 898
 }
899 899
 
900 900
 /**
@@ -904,10 +904,10 @@  discard block
 block discarded – undo
904 904
  * containing the themed output for the whole group.
905 905
  */
906 906
 function fieldgroup_preprocess_node(&$vars) {
907
-  $node = $vars['node'];
907
+    $node = $vars['node'];
908 908
 
909
-  foreach (fieldgroup_groups($node->type) as $group_name => $group) {
909
+    foreach (fieldgroup_groups($node->type) as $group_name => $group) {
910 910
     // '#chilren' might not be set if the group is empty.
911 911
     $vars[$group_name .'_rendered'] = isset($node->content[$group_name]['#children']) ? $node->content[$group_name]['#children'] : '';
912
-  }
912
+    }
913 913
 }
Please login to merge, or discard this patch.
Switch Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
  */
94 94
 function fieldgroup_content_fieldapi($op, $field) {
95 95
   switch ($op) {
96
-    case 'delete instance':
97
-      db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']);
98
-      cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
99
-      break;
96
+  case 'delete instance':
97
+    db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']);
98
+    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
99
+    break;
100 100
   }
101 101
 }
102 102
 
@@ -540,15 +540,15 @@  discard block
 block discarded – undo
540 540
  */
541 541
 function fieldgroup_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
542 542
   switch ($op) {
543
-    case 'view':
544
-      // Prevent against invalid 'nodes' built by broken 3rd party code.
545
-      if (isset($node->type)) {
546
-        // Build the node content element needed to render each fieldgroup.
547
-        foreach (fieldgroup_groups($node->type) as $group) {
548
-          fieldgroup_build_content($group, $node, $teaser, $page);
549
-        }
543
+  case 'view':
544
+    // Prevent against invalid 'nodes' built by broken 3rd party code.
545
+    if (isset($node->type)) {
546
+      // Build the node content element needed to render each fieldgroup.
547
+      foreach (fieldgroup_groups($node->type) as $group) {
548
+        fieldgroup_build_content($group, $node, $teaser, $page);
550 549
       }
551
-      break;
550
+    }
551
+    break;
552 552
   }
553 553
 }
554 554
 
@@ -591,22 +591,22 @@  discard block
 block discarded – undo
591 591
   $format = isset($group['settings']['display'][$context]['format']) ? $group['settings']['display'][$context]['format'] : 'fieldset';
592 592
 
593 593
   switch ($format) {
594
-    case 'simple':
595
-      $element['#type'] = 'fieldgroup_simple';
596
-      $element['#group_name'] = $group_name;
597
-      $element['#node'] = $node;
598
-      break;
599
-    case 'hidden':
600
-      $element['#access'] = FALSE;
601
-      break;
602
-    case 'fieldset_collapsed':
603
-      $element['#collapsed'] = TRUE;
604
-    case 'fieldset_collapsible':
605
-      $element['#collapsible'] = TRUE;
606
-    case 'fieldset':
607
-      $element['#type'] = 'fieldgroup_fieldset';
608
-      $element['#attributes'] = array('class' => 'fieldgroup '. strtr($group['group_name'], '_', '-'));
609
-      break;
594
+  case 'simple':
595
+    $element['#type'] = 'fieldgroup_simple';
596
+    $element['#group_name'] = $group_name;
597
+    $element['#node'] = $node;
598
+    break;
599
+  case 'hidden':
600
+    $element['#access'] = FALSE;
601
+    break;
602
+  case 'fieldset_collapsed':
603
+    $element['#collapsed'] = TRUE;
604
+  case 'fieldset_collapsible':
605
+    $element['#collapsible'] = TRUE;
606
+  case 'fieldset':
607
+    $element['#type'] = 'fieldgroup_fieldset';
608
+    $element['#attributes'] = array('class' => 'fieldgroup '. strtr($group['group_name'], '_', '-'));
609
+    break;
610 610
   }
611 611
   foreach ($group['fields'] as $field_name => $field) {
612 612
     if (isset($node->content[$field_name])) {
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * Implementation of hook_init().
17 17
  */
18 18
 function fieldgroup_init() {
19
-  drupal_add_css(drupal_get_path('module', 'fieldgroup') .'/fieldgroup.css');
19
+  drupal_add_css(drupal_get_path('module', 'fieldgroup').'/fieldgroup.css');
20 20
 }
21 21
 
22 22
 /**
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function fieldgroup_ctools_plugin_directory($module, $plugin) {
26 26
   if ($module == 'ctools' && $plugin == 'content_types') {
27
-    return 'panels/' . $plugin;
27
+    return 'panels/'.$plugin;
28 28
   }
29 29
 }
30 30
 
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
       $type_name = $type->type;
42 42
       $content_type = content_types($type_name);
43 43
       $type_url_str = $content_type['url_str'];
44
-      $items['admin/content/node-type/'. $type_url_str .'/groups/%'] = array(
44
+      $items['admin/content/node-type/'.$type_url_str.'/groups/%'] = array(
45 45
         'title' => 'Edit group',
46 46
         'page callback' => 'drupal_get_form',
47 47
         'page arguments' => array('fieldgroup_group_edit_form', $type_name, 5),
48 48
         'access arguments' => array('administer content types'),
49 49
         'type' => MENU_CALLBACK,
50 50
       );
51
-      $items['admin/content/node-type/'. $type_url_str .'/groups/%/remove'] = array(
51
+      $items['admin/content/node-type/'.$type_url_str.'/groups/%/remove'] = array(
52 52
         'title' => 'Edit group',
53 53
         'page callback' => 'drupal_get_form',
54 54
         'page arguments' => array('fieldgroup_remove_group', $type_name, 5),
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 function fieldgroup_content_fieldapi($op, $field) {
95 95
   switch ($op) {
96 96
     case 'delete instance':
97
-      db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']);
97
+      db_query("DELETE FROM {".fieldgroup_fields_tablename()."} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']);
98 98
       cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
99 99
       break;
100 100
   }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
   $form_values = $form_state['values'];
183 183
   $content_type = $form['#content_type'];
184 184
   fieldgroup_save_group($content_type['type'], $form_values);
185
-  $form_state['redirect'] = 'admin/content/node-type/'. $content_type['url_str'] .'/fields';
185
+  $form_state['redirect'] = 'admin/content/node-type/'.$content_type['url_str'].'/fields';
186 186
 }
187 187
 
188 188
 function fieldgroup_remove_group(&$form_state, $type_name, $group_name) {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
   return confirm_form($form,
203 203
                   t('Are you sure you want to remove the group %label?',
204 204
                   array('%label' => t($group['label']))),
205
-                  'admin/content/node-type/'. $content_type['url_str'] .'/fields', t('This action cannot be undone.'),
205
+                  'admin/content/node-type/'.$content_type['url_str'].'/fields', t('This action cannot be undone.'),
206 206
                   t('Remove'), t('Cancel'));
207 207
 }
208 208
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
   $group_name = $form['#group_name'];
213 213
   fieldgroup_delete($content_type['type'], $group_name);
214 214
   drupal_set_message(t('The group %group_name has been removed.', array('%group_name' => $group_name)));
215
-  $form_state['redirect'] = 'admin/content/node-type/'. $content_type['url_str'] .'/fields';
215
+  $form_state['redirect'] = 'admin/content/node-type/'.$content_type['url_str'].'/fields';
216 216
 }
217 217
 
218 218
 /**
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
   global $language;
223 223
   static $groups, $groups_sorted;
224 224
   if (!isset($groups) || $reset) {
225
-    if ($cached = cache_get('fieldgroup_data:'. $language->language, content_cache_tablename())) {
225
+    if ($cached = cache_get('fieldgroup_data:'.$language->language, content_cache_tablename())) {
226 226
       $data = $cached->data;
227 227
       $groups = $data['groups'];
228 228
       $groups_sorted = $data['groups_sorted'];
229 229
     }
230 230
     else {
231
-      $result = db_query("SELECT * FROM {". fieldgroup_tablename() ."} ORDER BY weight, group_name");
231
+      $result = db_query("SELECT * FROM {".fieldgroup_tablename()."} ORDER BY weight, group_name");
232 232
       $groups = array();
233 233
       $groups_sorted = array();
234 234
       while ($group = db_fetch_array($result)) {
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
         $groups_sorted[$group['type_name']][] = &$groups[$group['type_name']][$group['group_name']];
251 251
       }
252 252
       //load fields
253
-      $result = db_query("SELECT nfi.*, ng.group_name FROM {". fieldgroup_tablename() ."} ng ".
254
- "INNER JOIN {". fieldgroup_fields_tablename() ."} ngf ON ngf.type_name = ng.type_name AND ngf.group_name = ng.group_name ".
255
- "INNER JOIN {". content_instance_tablename() ."} nfi ON nfi.field_name = ngf.field_name AND nfi.type_name = ngf.type_name ".
253
+      $result = db_query("SELECT nfi.*, ng.group_name FROM {".fieldgroup_tablename()."} ng ".
254
+ "INNER JOIN {".fieldgroup_fields_tablename()."} ngf ON ngf.type_name = ng.type_name AND ngf.group_name = ng.group_name ".
255
+ "INNER JOIN {".content_instance_tablename()."} nfi ON nfi.field_name = ngf.field_name AND nfi.type_name = ngf.type_name ".
256 256
  "WHERE nfi.widget_active = 1 ORDER BY nfi.weight");
257 257
       while ($field = db_fetch_array($result)) {
258 258
         // Allow external modules to translate field strings.
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
         $groups[$field['type_name']][$field['group_name']]['fields'][$field['field_name']] = $field;
268 268
       }
269
-      cache_set('fieldgroup_data:'. $language->language, array('groups' => $groups, 'groups_sorted' => $groups_sorted), content_cache_tablename());
269
+      cache_set('fieldgroup_data:'.$language->language, array('groups' => $groups, 'groups_sorted' => $groups_sorted), content_cache_tablename());
270 270
     }
271 271
   }
272 272
   if (empty($content_type)) {
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 function _fieldgroup_groups_label($content_type) {
283 283
   $groups = fieldgroup_groups($content_type);
284 284
 
285
-  $labels[''] = '<'. t('none') .'>';
285
+  $labels[''] = '<'.t('none').'>';
286 286
   foreach ($groups as $group_name => $group) {
287 287
     $labels[$group_name] = t($group['label']);
288 288
   }
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 }
291 291
 
292 292
 function _fieldgroup_field_get_group($content_type, $field_name) {
293
-  return db_result(db_query("SELECT group_name FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $content_type, $field_name));
293
+  return db_result(db_query("SELECT group_name FROM {".fieldgroup_fields_tablename()."} WHERE type_name = '%s' AND field_name = '%s'", $content_type, $field_name));
294 294
 }
295 295
 
296 296
 /**
297 297
  * Implementation of hook_form_alter()
298 298
  */
299 299
 function fieldgroup_form_alter(&$form, $form_state, $form_id) {
300
-  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
300
+  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'].'_node_form' == $form_id) {
301 301
     foreach (fieldgroup_groups($form['type']['#value']) as $group_name => $group) {
302 302
       $form[$group_name] = array(
303 303
         '#type' => 'fieldset',
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
       // Can't use module_invoke_all because we want
335 335
       // to be able to use a reference to $form and $form_state.
336 336
       foreach (module_implements('fieldgroup_form') as $module) {
337
-        $function = $module .'_fieldgroup_form';
337
+        $function = $module.'_fieldgroup_form';
338 338
         $function($form, $form_state, $form_id, $group);
339 339
       }
340 340
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
     // Add the 'group_' prefix.
391 391
     if (substr($group_name, 0, 6) != 'group_') {
392
-      $group_name = 'group_'. $group_name;
392
+      $group_name = 'group_'.$group_name;
393 393
     }
394 394
 
395 395
     // Invalid field name.
@@ -422,10 +422,10 @@  discard block
 block discarded – undo
422 422
       foreach ($validation['errors'] as $type => $messages) {
423 423
         foreach ($messages as $message) {
424 424
           if ($type == 'label') {
425
-            form_set_error('_add_new_group][label', t('Add new group:') .' '. $message);
425
+            form_set_error('_add_new_group][label', t('Add new group:').' '.$message);
426 426
           }
427 427
           else {
428
-            form_set_error('_add_new_group][group_name', t('Add new group:') .' '. $message);
428
+            form_set_error('_add_new_group][group_name', t('Add new group:').' '.$message);
429 429
           }
430 430
         }
431 431
       }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     // If 'group' row:  update groups weights
491 491
     // (possible newly created group has already been taken care of).
492 492
     elseif (in_array($key, $form['#groups'])) {
493
-      db_query("UPDATE {". fieldgroup_tablename() ."} SET weight = %d WHERE type_name = '%s' AND group_name = '%s'",
493
+      db_query("UPDATE {".fieldgroup_tablename()."} SET weight = %d WHERE type_name = '%s' AND group_name = '%s'",
494 494
         $values['weight'], $type_name, $key);
495 495
     }
496 496
   }
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
   // - when a (non last) field is removed from a group, a 'ghost row' remains in the fields overview
533 533
   // - when the last field is removed, the group disappears
534 534
   // seems to be fixed when emptying the cache.
535
-  db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
535
+  db_query("DELETE FROM {".fieldgroup_fields_tablename()."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
536 536
 }
537 537
 
538 538
 /**
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
       $element['#collapsible'] = TRUE;
606 606
     case 'fieldset':
607 607
       $element['#type'] = 'fieldgroup_fieldset';
608
-      $element['#attributes'] = array('class' => 'fieldgroup '. strtr($group['group_name'], '_', '-'));
608
+      $element['#attributes'] = array('class' => 'fieldgroup '.strtr($group['group_name'], '_', '-'));
609 609
       break;
610 610
   }
611 611
   foreach ($group['fields'] as $field_name => $field) {
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
   // Can't use module_invoke_all because we want
619 619
   // to be able to use a reference to $node and $element.
620 620
   foreach (module_implements('fieldgroup_view') as $module) {
621
-    $function = $module .'_fieldgroup_view';
621
+    $function = $module.'_fieldgroup_view';
622 622
     $function($node, $element, $group, $context);
623 623
   }
624 624
 
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 
696 696
       // One-field equivalent to _content_field_invoke('sanitize').
697 697
       $module = $field_types[$field['type']]['module'];
698
-      $function = $module .'_field';
698
+      $function = $module.'_field';
699 699
       if (function_exists($function)) {
700 700
         $function('sanitize', $node_copy, $field, $items, $teaser, $page);
701 701
         $node_copy->{$field_name} = $items;
@@ -755,13 +755,13 @@  discard block
 block discarded – undo
755 755
 function fieldgroup_node_type($op, $info) {
756 756
   if ($op == 'update' && !empty($info->old_type) && $info->type != $info->old_type) {
757 757
     // update the tables
758
-    db_query("UPDATE {". fieldgroup_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
759
-    db_query("UPDATE {". fieldgroup_fields_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
758
+    db_query("UPDATE {".fieldgroup_tablename()."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
759
+    db_query("UPDATE {".fieldgroup_fields_tablename()."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
760 760
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
761 761
   }
762 762
   elseif ($op == 'delete') {
763
-    db_query("DELETE FROM {". fieldgroup_tablename() ."} WHERE type_name = '%s'", $info->type);
764
-    db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s'", $info->type);
763
+    db_query("DELETE FROM {".fieldgroup_tablename()."} WHERE type_name = '%s'", $info->type);
764
+    db_query("DELETE FROM {".fieldgroup_fields_tablename()."} WHERE type_name = '%s'", $info->type);
765 765
   }
766 766
 }
767 767
 
@@ -800,19 +800,19 @@  discard block
 block discarded – undo
800 800
 
801 801
   // Allow other modules to intervene when the group is saved.
802 802
   foreach (module_implements('fieldgroup_save_group') as $module) {
803
-    $function = $module .'_fieldgroup_save_group';
803
+    $function = $module.'_fieldgroup_save_group';
804 804
     $function($group);
805 805
   }
806 806
 
807 807
   if (!isset($groups[$group['group_name']])) {
808 808
     // Accept group name from programmed submissions if valid.
809
-    db_query("INSERT INTO {". fieldgroup_tablename() ."} (group_type, type_name, group_name, label, settings, weight)".
809
+    db_query("INSERT INTO {".fieldgroup_tablename()."} (group_type, type_name, group_name, label, settings, weight)".
810 810
       " VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $group['group_type'], $type_name, $group['group_name'], $group['label'], serialize($group['settings']), $group['weight']);
811 811
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
812 812
     return SAVED_NEW;
813 813
   }
814 814
   else {
815
-    db_query("UPDATE {". fieldgroup_tablename() ."} SET group_type = '%s', label = '%s', settings = '%s', weight = %d ".
815
+    db_query("UPDATE {".fieldgroup_tablename()."} SET group_type = '%s', label = '%s', settings = '%s', weight = %d ".
816 816
              "WHERE type_name = '%s' AND group_name = '%s'",
817 817
              $group['group_type'], $group['label'], serialize($group['settings']), $group['weight'], $type_name, $group['group_name']);
818 818
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
@@ -825,21 +825,21 @@  discard block
 block discarded – undo
825 825
 
826 826
   if ($default != $form_values['group']) {
827 827
     if ($form_values['group'] && !$default) {
828
-      db_query("INSERT INTO {". fieldgroup_fields_tablename() ."} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')", $form_values['type_name'], $form_values['group'], $form_values['field_name']);
828
+      db_query("INSERT INTO {".fieldgroup_fields_tablename()."} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')", $form_values['type_name'], $form_values['group'], $form_values['field_name']);
829 829
     }
830 830
     elseif ($form_values['group']) {
831
-      db_query("UPDATE {". fieldgroup_fields_tablename() ."} SET group_name = '%s' WHERE type_name = '%s' AND field_name = '%s'", $form_values['group'], $form_values['type_name'], $form_values['field_name']);
831
+      db_query("UPDATE {".fieldgroup_fields_tablename()."} SET group_name = '%s' WHERE type_name = '%s' AND field_name = '%s'", $form_values['group'], $form_values['type_name'], $form_values['field_name']);
832 832
     }
833 833
     else {
834
-      db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
834
+      db_query("DELETE FROM {".fieldgroup_fields_tablename()."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
835 835
     }
836 836
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
837 837
   }
838 838
 }
839 839
 
840 840
 function fieldgroup_delete($content_type, $group_name) {
841
-  db_query("DELETE FROM {". fieldgroup_tablename() ."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
842
-  db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
841
+  db_query("DELETE FROM {".fieldgroup_tablename()."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
842
+  db_query("DELETE FROM {".fieldgroup_fields_tablename()."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
843 843
   cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
844 844
 }
845 845
 
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
       $element['#attributes']['class'] .= ' collapsed';
866 866
     }
867 867
   }
868
-  return '<fieldset'. drupal_attributes($element['#attributes']) .'>'. ($element['#title'] ? '<legend>'. $element['#title'] .'</legend>' : '') . (isset($element['#description']) && $element['#description'] ? '<div class="description">'. $element['#description'] .'</div>' : '') . (!empty($element['#children']) ? $element['#children'] : '') . (isset($element['#value']) ? $element['#value'] : '') ."</fieldset>\n";
868
+  return '<fieldset'.drupal_attributes($element['#attributes']).'>'.($element['#title'] ? '<legend>'.$element['#title'].'</legend>' : '').(isset($element['#description']) && $element['#description'] ? '<div class="description">'.$element['#description'].'</div>' : '').(!empty($element['#children']) ? $element['#children'] : '').(isset($element['#value']) ? $element['#value'] : '')."</fieldset>\n";
869 869
 }
870 870
 
871 871
 
@@ -886,14 +886,14 @@  discard block
 block discarded – undo
886 886
 
887 887
   $vars['group_name'] = $element['#group_name'];
888 888
   $vars['group_name_css'] = strtr($element['#group_name'], '_', '-');
889
-  $vars['label'] = isset($element['#title']) ? $element['#title'] : '';;
890
-  $vars['description'] = isset($element['#description']) ? $element['#description'] : '';;
889
+  $vars['label'] = isset($element['#title']) ? $element['#title'] : ''; ;
890
+  $vars['description'] = isset($element['#description']) ? $element['#description'] : ''; ;
891 891
   $vars['content'] = isset($element['#children']) ? $element['#children'] : '';
892 892
   $vars['template_files'] = array(
893 893
     'fieldgroup-simple-',
894
-    'fieldgroup-simple-'. $element['#group_name'],
895
-    'fieldgroup-simple-'. $element['#node']->type,
896
-    'fieldgroup-simple-'. $element['#group_name'] .'-'. $element['#node']->type,
894
+    'fieldgroup-simple-'.$element['#group_name'],
895
+    'fieldgroup-simple-'.$element['#node']->type,
896
+    'fieldgroup-simple-'.$element['#group_name'].'-'.$element['#node']->type,
897 897
   );
898 898
 }
899 899
 
@@ -908,6 +908,6 @@  discard block
 block discarded – undo
908 908
 
909 909
   foreach (fieldgroup_groups($node->type) as $group_name => $group) {
910 910
     // '#chilren' might not be set if the group is empty.
911
-    $vars[$group_name .'_rendered'] = isset($node->content[$group_name]['#children']) ? $node->content[$group_name]['#children'] : '';
911
+    $vars[$group_name.'_rendered'] = isset($node->content[$group_name]['#children']) ? $node->content[$group_name]['#children'] : '';
912 912
   }
913 913
 }
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -226,8 +226,7 @@  discard block
 block discarded – undo
226 226
       $data = $cached->data;
227 227
       $groups = $data['groups'];
228 228
       $groups_sorted = $data['groups_sorted'];
229
-    }
230
-    else {
229
+    } else {
231 230
       $result = db_query("SELECT * FROM {". fieldgroup_tablename() ."} ORDER BY weight, group_name");
232 231
       $groups = array();
233 232
       $groups_sorted = array();
@@ -271,8 +270,7 @@  discard block
 block discarded – undo
271 270
   }
272 271
   if (empty($content_type)) {
273 272
     return $groups;
274
-  }
275
-  elseif (empty($groups) || empty($groups[$content_type])) {
273
+  } elseif (empty($groups) || empty($groups[$content_type])) {
276 274
     return array();
277 275
   }
278 276
   return $sorted ? $groups_sorted[$content_type] : $groups[$content_type];
@@ -349,18 +347,15 @@  discard block
 block discarded – undo
349 347
       '#type' => 'value',
350 348
       '#value' => _fieldgroup_field_get_group($content_type['type'], $form['field_name']['#value']),
351 349
     );
352
-  }
353
-  elseif ($form_id == 'content_field_overview_form') {
350
+  } elseif ($form_id == 'content_field_overview_form') {
354 351
     $form['#validate'][] = 'fieldgroup_field_overview_form_validate';
355 352
     $form['#submit'][] = 'fieldgroup_field_overview_form_submit';
356
-  }
357
-  elseif ($form_id == 'content_display_overview_form' && !empty($form['#groups'])) {
353
+  } elseif ($form_id == 'content_display_overview_form' && !empty($form['#groups'])) {
358 354
     $form['#submit'][] = 'fieldgroup_display_overview_form_submit';
359 355
     if (!isset($form['submit'])) {
360 356
       $form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 10);
361 357
     }
362
-  }
363
-  elseif ($form_id == 'content_field_remove_form') {
358
+  } elseif ($form_id == 'content_field_remove_form') {
364 359
     $form['#submit'][] = 'fieldgroup_field_remove_form_submit';
365 360
   }
366 361
 }
@@ -423,8 +418,7 @@  discard block
 block discarded – undo
423 418
         foreach ($messages as $message) {
424 419
           if ($type == 'label') {
425 420
             form_set_error('_add_new_group][label', t('Add new group:') .' '. $message);
426
-          }
427
-          else {
421
+          } else {
428 422
             form_set_error('_add_new_group][group_name', t('Add new group:') .' '. $message);
429 423
           }
430 424
         }
@@ -432,8 +426,7 @@  discard block
 block discarded – undo
432 426
     }
433 427
     $group_name = $validation['group_name'];
434 428
     form_set_value($form['_add_new_group']['group_name'], $group_name, $form_state);
435
-  }
436
-  else {
429
+  } else {
437 430
     // Fail validation if attempt to nest fields under a new group without the
438 431
     // proper information. Not raising an error would cause the nested fields
439 432
     // to get weights the user doesn't expect.
@@ -474,8 +467,7 @@  discard block
 block discarded – undo
474 467
         // in $form_state['fields_added'] for us.
475 468
         if (isset($form_state['fields_added'][$key])) {
476 469
           $key = $form_state['fields_added'][$key];
477
-        }
478
-        else {
470
+        } else {
479 471
           // No field was actually created : skip to next row.
480 472
           continue;
481 473
         }
@@ -572,8 +564,7 @@  discard block
 block discarded – undo
572 564
   // NODE_BUILD_NORMAL is 0, and ('whatever' == 0) is TRUE, so we need a ===.
573 565
   if ($node->build_mode === NODE_BUILD_NORMAL || $node->build_mode == NODE_BUILD_PREVIEW) {
574 566
     $context = $teaser ? 'teaser' : 'full';
575
-  }
576
-  else {
567
+  } else {
577 568
     $context = $node->build_mode;
578 569
   }
579 570
 
@@ -758,8 +749,7 @@  discard block
 block discarded – undo
758 749
     db_query("UPDATE {". fieldgroup_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
759 750
     db_query("UPDATE {". fieldgroup_fields_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
760 751
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
761
-  }
762
-  elseif ($op == 'delete') {
752
+  } elseif ($op == 'delete') {
763 753
     db_query("DELETE FROM {". fieldgroup_tablename() ."} WHERE type_name = '%s'", $info->type);
764 754
     db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s'", $info->type);
765 755
   }
@@ -810,8 +800,7 @@  discard block
 block discarded – undo
810 800
       " VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $group['group_type'], $type_name, $group['group_name'], $group['label'], serialize($group['settings']), $group['weight']);
811 801
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
812 802
     return SAVED_NEW;
813
-  }
814
-  else {
803
+  } else {
815 804
     db_query("UPDATE {". fieldgroup_tablename() ."} SET group_type = '%s', label = '%s', settings = '%s', weight = %d ".
816 805
              "WHERE type_name = '%s' AND group_name = '%s'",
817 806
              $group['group_type'], $group['label'], serialize($group['settings']), $group['weight'], $type_name, $group['group_name']);
@@ -826,11 +815,9 @@  discard block
 block discarded – undo
826 815
   if ($default != $form_values['group']) {
827 816
     if ($form_values['group'] && !$default) {
828 817
       db_query("INSERT INTO {". fieldgroup_fields_tablename() ."} (type_name, group_name, field_name) VALUES ('%s', '%s', '%s')", $form_values['type_name'], $form_values['group'], $form_values['field_name']);
829
-    }
830
-    elseif ($form_values['group']) {
818
+    } elseif ($form_values['group']) {
831 819
       db_query("UPDATE {". fieldgroup_fields_tablename() ."} SET group_name = '%s' WHERE type_name = '%s' AND field_name = '%s'", $form_values['group'], $form_values['type_name'], $form_values['field_name']);
832
-    }
833
-    else {
820
+    } else {
834 821
       db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
835 822
     }
836 823
     cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
   return array(
68 68
     'fieldgroup_simple' => array(
69 69
       'template' => 'fieldgroup-simple',
70
-      'arguments' => array('element' => NULL),
70
+      'arguments' => array('element' => null),
71 71
     ),
72 72
     'fieldgroup_fieldset' => array(
73
-      'arguments' => array('element' => NULL),
73
+      'arguments' => array('element' => null),
74 74
     ),
75 75
     'fieldgroup_display_overview_form' => array(
76
-      'arguments' => array('form' => NULL),
76
+      'arguments' => array('form' => null),
77 77
     ),
78 78
   );
79 79
 }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 function fieldgroup_elements() {
85 85
   return array(
86 86
     'fieldgroup_simple' => array(),
87
-    'fieldgroup_fieldset' => array('#collapsible' => FALSE, '#collapsed' => FALSE, '#value' => NULL,),
87
+    'fieldgroup_fieldset' => array('#collapsible' => false, '#collapsed' => false, '#value' => null,),
88 88
   );
89 89
 }
90 90
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
   switch ($op) {
96 96
     case 'delete instance':
97 97
       db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE field_name = '%s' AND type_name = '%s'", $field['field_name'], $field['type_name']);
98
-      cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
98
+      cache_clear_all('fieldgroup_data:', content_cache_tablename(), true);
99 99
       break;
100 100
   }
101 101
 }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     '#type' => 'textfield',
114 114
     '#title' => t('Label'),
115 115
     '#default_value' => $group['label'],
116
-    '#required' => TRUE,
116
+    '#required' => true,
117 117
   );
118 118
 
119 119
   // Set a default value for group type early in the form so it
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
   $group_type = !empty($group['group_type']) ? $group['group_type'] : 'standard';
122 122
   $form['group_type'] = array('#type' => 'hidden', '#default_value' => $group_type);
123 123
 
124
-  $form['settings']['#tree'] = TRUE;
124
+  $form['settings']['#tree'] = true;
125 125
   $form['settings']['form'] = array(
126 126
     '#type' => 'fieldset',
127 127
     '#title' => t('Form settings'),
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     '#default_value' => $group['settings']['form']['description'],
144 144
     '#rows' => 5,
145 145
     '#description' => t('Instructions to present to the user on the editing form.'),
146
-    '#required' => FALSE,
146
+    '#required' => false,
147 147
   );
148 148
   $form['settings']['display'] = array(
149 149
     '#type' => 'fieldset',
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     '#default_value' => $group['settings']['display']['description'],
157 157
     '#rows' => 5,
158 158
     '#description' => t('A description of the group.'),
159
-    '#required' => FALSE,
159
+    '#required' => false,
160 160
   );
161 161
 
162 162
   foreach (array_keys(content_build_modes()) as $key) {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 /**
219 219
  * Returns all groups for a content type
220 220
  */
221
-function fieldgroup_groups($content_type = '', $sorted = FALSE, $reset = FALSE) {
221
+function fieldgroup_groups($content_type = '', $sorted = false, $reset = false) {
222 222
   global $language;
223 223
   static $groups, $groups_sorted;
224 224
   if (!isset($groups) || $reset) {
@@ -309,13 +309,13 @@  discard block
 block discarded – undo
309 309
         '#attributes' => array('class' => strtr($group['group_name'], '_', '-')),
310 310
       );
311 311
 
312
-      $has_accessible_field = FALSE;
312
+      $has_accessible_field = false;
313 313
       foreach ($group['fields'] as $field_name => $field) {
314 314
         if (isset($form[$field_name])) {
315 315
           $form[$group_name][$field_name] = $form[$field_name];
316 316
           // Track whether this group has any accessible fields within it.
317
-          if (!isset($form[$field_name]['#access']) || $form[$field_name]['#access'] !== FALSE) {
318
-            $has_accessible_field = TRUE;
317
+          if (!isset($form[$field_name]['#access']) || $form[$field_name]['#access'] !== false) {
318
+            $has_accessible_field = true;
319 319
           }
320 320
           unset($form[$field_name]);
321 321
         }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
       if (!$has_accessible_field) {
329 329
         // Hide the fieldgroup, because the fields are inaccessible.
330
-        $form[$group_name]['#access'] = FALSE;
330
+        $form[$group_name]['#access'] = false;
331 331
       }
332 332
 
333 333
       // Allow other modules to alter the form.
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
     }
496 496
   }
497 497
 
498
-  cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
498
+  cache_clear_all('fieldgroup_data:', content_cache_tablename(), true);
499 499
 }
500 500
 
501 501
 function field_group_default_settings($group_type) {
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 /**
539 539
  * Implementation of hook_nodeapi().
540 540
  */
541
-function fieldgroup_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
541
+function fieldgroup_nodeapi(&$node, $op, $teaser = null, $page = null) {
542 542
   switch ($op) {
543 543
     case 'view':
544 544
       // Prevent against invalid 'nodes' built by broken 3rd party code.
@@ -597,12 +597,12 @@  discard block
 block discarded – undo
597 597
       $element['#node'] = $node;
598 598
       break;
599 599
     case 'hidden':
600
-      $element['#access'] = FALSE;
600
+      $element['#access'] = false;
601 601
       break;
602 602
     case 'fieldset_collapsed':
603
-      $element['#collapsed'] = TRUE;
603
+      $element['#collapsed'] = true;
604 604
     case 'fieldset_collapsible':
605
-      $element['#collapsible'] = TRUE;
605
+      $element['#collapsible'] = true;
606 606
     case 'fieldset':
607 607
       $element['#type'] = 'fieldgroup_fieldset';
608 608
       $element['#attributes'] = array('class' => 'fieldgroup '. strtr($group['group_name'], '_', '-'));
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
  *
674 674
  * @see content_view_field()
675 675
  */
676
-function fieldgroup_view_group($group, &$node, $teaser = FALSE, $page = FALSE) {
676
+function fieldgroup_view_group($group, &$node, $teaser = false, $page = false) {
677 677
   $group_name = $group['group_name'];
678 678
   $field_types = _content_field_types();
679 679
 
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
       return $group_name;
746 746
     }
747 747
   }
748
-  return FALSE;
748
+  return false;
749 749
 }
750 750
 
751 751
 /**
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
     // update the tables
758 758
     db_query("UPDATE {". fieldgroup_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
759 759
     db_query("UPDATE {". fieldgroup_fields_tablename() ."} SET type_name='%s' WHERE type_name='%s'", array($info->type, $info->old_type));
760
-    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
760
+    cache_clear_all('fieldgroup_data:', content_cache_tablename(), true);
761 761
   }
762 762
   elseif ($op == 'delete') {
763 763
     db_query("DELETE FROM {". fieldgroup_tablename() ."} WHERE type_name = '%s'", $info->type);
@@ -772,14 +772,14 @@  discard block
 block discarded – undo
772 772
   return $types;
773 773
 }
774 774
 
775
-function fieldgroup_tablename($version = NULL) {
775
+function fieldgroup_tablename($version = null) {
776 776
   if (is_null($version)) {
777 777
     $version = variable_get('fieldgroup_schema_version', 0);
778 778
   }
779 779
   return $version < 6000 ? 'node_group' : 'content_group';
780 780
 }
781 781
 
782
-function fieldgroup_fields_tablename($version = NULL) {
782
+function fieldgroup_fields_tablename($version = null) {
783 783
   if (is_null($version)) {
784 784
     $version = variable_get('fieldgroup_schema_version', 0);
785 785
   }
@@ -808,14 +808,14 @@  discard block
 block discarded – undo
808 808
     // Accept group name from programmed submissions if valid.
809 809
     db_query("INSERT INTO {". fieldgroup_tablename() ."} (group_type, type_name, group_name, label, settings, weight)".
810 810
       " VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $group['group_type'], $type_name, $group['group_name'], $group['label'], serialize($group['settings']), $group['weight']);
811
-    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
811
+    cache_clear_all('fieldgroup_data:', content_cache_tablename(), true);
812 812
     return SAVED_NEW;
813 813
   }
814 814
   else {
815 815
     db_query("UPDATE {". fieldgroup_tablename() ."} SET group_type = '%s', label = '%s', settings = '%s', weight = %d ".
816 816
              "WHERE type_name = '%s' AND group_name = '%s'",
817 817
              $group['group_type'], $group['label'], serialize($group['settings']), $group['weight'], $type_name, $group['group_name']);
818
-    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
818
+    cache_clear_all('fieldgroup_data:', content_cache_tablename(), true);
819 819
     return SAVED_UPDATED;
820 820
   }
821 821
 }
@@ -833,14 +833,14 @@  discard block
 block discarded – undo
833 833
     else {
834 834
       db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE type_name = '%s' AND field_name = '%s'", $form_values['type_name'], $form_values['field_name']);
835 835
     }
836
-    cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
836
+    cache_clear_all('fieldgroup_data:', content_cache_tablename(), true);
837 837
   }
838 838
 }
839 839
 
840 840
 function fieldgroup_delete($content_type, $group_name) {
841 841
   db_query("DELETE FROM {". fieldgroup_tablename() ."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
842 842
   db_query("DELETE FROM {". fieldgroup_fields_tablename() ."} WHERE  type_name = '%s' AND group_name = '%s'", $content_type, $group_name);
843
-  cache_clear_all('fieldgroup_data:', content_cache_tablename(), TRUE);
843
+  cache_clear_all('fieldgroup_data:', content_cache_tablename(), true);
844 844
 }
845 845
 
846 846
 /**
Please login to merge, or discard this patch.
boinc/modules/contrib/cck/modules/nodereference/nodereference.rules.inc 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,37 +10,37 @@  discard block
 block discarded – undo
10 10
  * Implementation of hook_rules_action_info().
11 11
  */
12 12
 function nodereference_rules_action_info() {
13
-  $info = array();
14
-  $info['nodereference_rules_action_load'] = array(
13
+    $info = array();
14
+    $info['nodereference_rules_action_load'] = array(
15 15
     'label' => t('Load a referenced node'),
16 16
     'arguments' => array(
17
-      'node' => array(
17
+        'node' => array(
18 18
         'type' => 'node',
19 19
         'label' => t('Content containing the node reference field'),
20
-      ),
20
+        ),
21 21
     ),
22 22
     'new variables' => array(
23
-      'referenced_node' => array(
23
+        'referenced_node' => array(
24 24
         'type' => 'node',
25 25
         'label' => t('Referenced content'),
26
-      ),
26
+        ),
27 27
     ),
28 28
     'module' => 'CCK',
29 29
     'help' => t('Note that if the field has multiple values, only the first content node will be loaded.'),
30
-  );
31
-  return $info;
30
+    );
31
+    return $info;
32 32
 }
33 33
 
34 34
 function nodereference_rules_action_load($node, $settings) {
35
-  if ($nid = $node->{$settings['field']}[0]['nid']) {
35
+    if ($nid = $node->{$settings['field']}[0]['nid']) {
36 36
     return array('referenced_node' => node_load(array('nid' => $nid)));
37
-  }
37
+    }
38 38
 }
39 39
 
40 40
 function nodereference_rules_action_load_form($settings, &$form) {
41
-  $settings += array('field' => '');
42
-  $options = content_rules_get_field_names_by_type('nodereference');
43
-  $form['settings']['field'] = array(
41
+    $settings += array('field' => '');
42
+    $options = content_rules_get_field_names_by_type('nodereference');
43
+    $form['settings']['field'] = array(
44 44
     '#type' => 'select',
45 45
     '#title' => t('Field'),
46 46
     '#default_value' => $settings['field'],
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     '#required' => TRUE,
49 49
     '#disabled' => empty($options),
50 50
     '#description' => empty($options) ? t('There are no nodereference fields defined.') : '',
51
-  );
51
+    );
52 52
 }
53 53
 
54 54
 /**
@@ -56,5 +56,5 @@  discard block
 block discarded – undo
56 56
  * "workflow_ng_action_load_referenced_node" to the equivalent rules action.
57 57
  */
58 58
 function workflow_ng_action_load_referenced_node_upgrade(&$element) {
59
-  $element['#name'] = 'nodereference_rules_action_load';
59
+    $element['#name'] = 'nodereference_rules_action_load';
60 60
 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
     '#title' => t('Field'),
46 46
     '#default_value' => $settings['field'],
47 47
     '#options' => $options,
48
-    '#required' => TRUE,
48
+    '#required' => true,
49 49
     '#disabled' => empty($options),
50 50
     '#description' => empty($options) ? t('There are no nodereference fields defined.') : '',
51 51
   );
Please login to merge, or discard this patch.
cck/modules/nodereference/panels/relationships/node_from_noderef.inc 3 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * Implementation of hook_ctools_relationships().
11 11
  */
12 12
 function nodereference_node_from_noderef_ctools_relationships() {
13
-  return array(
13
+    return array(
14 14
     'title' => t('Node from reference'),
15 15
     'keyword' => 'nodereference',
16 16
     'description' => t('Adds a node from a node reference in a node context; if multiple nodes are referenced, this will get the first referenced node only.'),
@@ -18,59 +18,59 @@  discard block
 block discarded – undo
18 18
     'context' => 'nodereference_node_from_noderef_context',
19 19
     'settings form' => 'nodereference_node_from_noderef_settings_form',
20 20
     'settings form validate' => 'nodereference_node_from_noderef_settings_form_validate',
21
-  );
21
+    );
22 22
 }
23 23
 
24 24
 /**
25 25
  * Return a new ctools context based on an existing context.
26 26
  */
27 27
 function nodereference_node_from_noderef_context($context, $conf) {
28
-  $field = content_fields($conf['field_name']);
28
+    $field = content_fields($conf['field_name']);
29 29
 
30
-  // If unset it wants a generic, unfilled context, which is just NULL.
31
-  if (empty($context->data)) {
30
+    // If unset it wants a generic, unfilled context, which is just NULL.
31
+    if (empty($context->data)) {
32 32
     $new_context = ctools_context_create_empty('node', NULL);
33
-  }
34
-  else if (isset($context->data->{$conf['field_name']}[0]['nid']) && ($nid = $context->data->{$conf['field_name']}[0]['nid'])) {
33
+    }
34
+    else if (isset($context->data->{$conf['field_name']}[0]['nid']) && ($nid = $context->data->{$conf['field_name']}[0]['nid'])) {
35 35
     if ($node = node_load($nid)) {
36
-      $new_context = ctools_context_create('node', $node);
36
+        $new_context = ctools_context_create('node', $node);
37
+    }
37 38
     }
38
-  }
39 39
 
40
-  if (!empty($new_context)) {
40
+    if (!empty($new_context)) {
41 41
     // Have nodereference relationships limit CCK field availability as well.
42 42
     $restrictions = array_keys(array_filter($field['referenceable_types']));
43 43
     if ($restrictions) {
44
-      if (isset($new_context->restrictions['type'])) {
44
+        if (isset($new_context->restrictions['type'])) {
45 45
         $new_context->restrictions['type'] = array_unique(array_merge($new_context->restrictions['type'], $restrictions));
46
-      }
47
-      else {
46
+        }
47
+        else {
48 48
         $new_context->restrictions['type'] = $restrictions;
49
-      }
49
+        }
50 50
     }
51 51
 
52 52
     return $new_context;
53
-  }
53
+    }
54 54
 }
55 55
 
56 56
 /**
57 57
  * Settings form for the ctools relationship.
58 58
  */
59 59
 function nodereference_node_from_noderef_settings_form($conf) {
60
-  $options = array();
61
-  foreach (content_fields() as $field) {
60
+    $options = array();
61
+    foreach (content_fields() as $field) {
62 62
     if ($field['type'] == 'nodereference') {
63
-      $options[$field['field_name']] = t($field['widget']['label']);
63
+        $options[$field['field_name']] = t($field['widget']['label']);
64
+    }
64 65
     }
65
-  }
66
-  $form['field_name'] = array(
66
+    $form['field_name'] = array(
67 67
     '#title' => t('Node reference field'),
68 68
     '#type' => 'select',
69 69
     '#options' => $options,
70 70
     '#default_value' => isset($conf['field_name']) ? $conf['field_name'] : '',
71 71
     '#prefix' => '<div class="clear-block">',
72 72
     '#suffix' => '</div>',
73
-  );
73
+    );
74 74
 
75
-  return $form;
75
+    return $form;
76 76
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
   // If unset it wants a generic, unfilled context, which is just NULL.
31 31
   if (empty($context->data)) {
32 32
     $new_context = ctools_context_create_empty('node', NULL);
33
-  }
34
-  else if (isset($context->data->{$conf['field_name']}[0]['nid']) && ($nid = $context->data->{$conf['field_name']}[0]['nid'])) {
33
+  } else if (isset($context->data->{$conf['field_name']}[0]['nid']) && ($nid = $context->data->{$conf['field_name']}[0]['nid'])) {
35 34
     if ($node = node_load($nid)) {
36 35
       $new_context = ctools_context_create('node', $node);
37 36
     }
@@ -43,8 +42,7 @@  discard block
 block discarded – undo
43 42
     if ($restrictions) {
44 43
       if (isset($new_context->restrictions['type'])) {
45 44
         $new_context->restrictions['type'] = array_unique(array_merge($new_context->restrictions['type'], $restrictions));
46
-      }
47
-      else {
45
+      } else {
48 46
         $new_context->restrictions['type'] = $restrictions;
49 47
       }
50 48
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
   // If unset it wants a generic, unfilled context, which is just NULL.
31 31
   if (empty($context->data)) {
32
-    $new_context = ctools_context_create_empty('node', NULL);
32
+    $new_context = ctools_context_create_empty('node', null);
33 33
   }
34 34
   else if (isset($context->data->{$conf['field_name']}[0]['nid']) && ($nid = $context->data->{$conf['field_name']}[0]['nid'])) {
35 35
     if ($node = node_load($nid)) {
Please login to merge, or discard this patch.