@@ -64,8 +64,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -226,8 +226,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -30,8 +30,7 @@ discard block |
||
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 |
||
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 | } |
@@ -96,8 +96,7 @@ discard block |
||
96 | 96 | if ($view->base_table == 'node' && !empty($view->display['default']->display_options['fields'])) { |
97 | 97 | if ($view->type == 'Default') { |
98 | 98 | $views[t('Default Views')][$view->name] = $view->name; |
99 | - } |
|
100 | - else { |
|
99 | + } else { |
|
101 | 100 | $views[t('Existing Views')][$view->name] = $view->name; |
102 | 101 | } |
103 | 102 | } |
@@ -125,8 +124,7 @@ discard block |
||
125 | 124 | '#required' => FALSE, |
126 | 125 | '#description' => t('Provide a comma separated list of arguments to pass to the view.'), |
127 | 126 | ); |
128 | - } |
|
129 | - else { |
|
127 | + } else { |
|
130 | 128 | $form['advanced']['no_view_help'] = array( |
131 | 129 | '#value' => t('<p>The list of nodes that can be referenced can be based on a "Views module" view but no appropriate views were found. <br />Note:</p>') . |
132 | 130 | t('<ul><li>Only views that have fields will work for this purpose.</li><li>This will discard the "Content types" settings above. Use the view\'s "filters" section instead.</li><li>Use the view\'s "fields" section to display additional informations about candidate nodes on node creation/edition form.</li><li>Use the view\'s "sort criteria" section to determine the order in which candidate nodes will be displayed.</li></ul>'), |
@@ -212,10 +210,11 @@ discard block |
||
212 | 210 | if (is_array($item) && !empty($item['nid'])) { |
213 | 211 | if (is_numeric($item['nid'])) { |
214 | 212 | $ids[] = $item['nid']; |
215 | - } |
|
216 | - else { |
|
213 | + } else { |
|
217 | 214 | $error_element = isset($item['_error_element']) ? $item['_error_element'] : ''; |
218 | - if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']); |
|
215 | + if (is_array($item) && isset($item['_error_element'])) { |
|
216 | + unset($item['_error_element']); |
|
217 | + } |
|
219 | 218 | form_set_error($error_element, t("%name: invalid input.", array('%name' => t($field['widget']['label'])))); |
220 | 219 | } |
221 | 220 | } |
@@ -226,7 +225,9 @@ discard block |
||
226 | 225 | foreach ($items as $delta => $item) { |
227 | 226 | if (is_array($item)) { |
228 | 227 | $error_element = isset($item['_error_element']) ? $item['_error_element'] : ''; |
229 | - if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']); |
|
228 | + if (is_array($item) && isset($item['_error_element'])) { |
|
229 | + unset($item['_error_element']); |
|
230 | + } |
|
230 | 231 | if (!empty($item['nid']) && !isset($refs[$item['nid']])) { |
231 | 232 | form_set_error($error_element, t("%name: this post can't be referenced.", array('%name' => t($field['widget']['label'])))); |
232 | 233 | } |
@@ -487,8 +488,7 @@ discard block |
||
487 | 488 | '#element_validate' => array('_element_validate_integer_positive'), |
488 | 489 | '#required' => TRUE, |
489 | 490 | ); |
490 | - } |
|
491 | - else { |
|
491 | + } else { |
|
492 | 492 | $form['autocomplete_match'] = array('#type' => 'hidden', '#value' => $match); |
493 | 493 | $form['size'] = array('#type' => 'hidden', '#value' => $size); |
494 | 494 | } |
@@ -736,14 +736,12 @@ discard block |
||
736 | 736 | if (!empty($title) && ($n = node_load($nid)) && trim($title) != trim($n->title)) { |
737 | 737 | form_error($element[$field_key], t('%name: title mismatch. Please check your selection.', array('%name' => t($field['widget']['label'])))); |
738 | 738 | } |
739 | - } |
|
740 | - else { |
|
739 | + } else { |
|
741 | 740 | // No explicit nid. |
742 | 741 | $reference = _nodereference_potential_references($field, $value, 'equals', NULL, 1); |
743 | 742 | if (empty($reference)) { |
744 | 743 | form_error($element[$field_key], t('%name: found no valid post with that title.', array('%name' => t($field['widget']['label'])))); |
745 | - } |
|
746 | - else { |
|
744 | + } else { |
|
747 | 745 | // TODO: |
748 | 746 | // the best thing would be to present the user with an additional form, |
749 | 747 | // allowing the user to choose between valid candidates with the same title |
@@ -868,8 +866,7 @@ discard block |
||
868 | 866 | if (!empty($field['advanced_view_args'])) { |
869 | 867 | // TODO: Support Tokens using token.module ? |
870 | 868 | $view_args = array_map('trim', explode(',', $field['advanced_view_args'])); |
871 | - } |
|
872 | - else { |
|
869 | + } else { |
|
873 | 870 | $view_args = array(); |
874 | 871 | } |
875 | 872 | |
@@ -894,8 +891,7 @@ discard block |
||
894 | 891 | |
895 | 892 | // Get the results. |
896 | 893 | $result = $view->execute_display($display, $view_args); |
897 | - } |
|
898 | - else { |
|
894 | + } else { |
|
899 | 895 | $result = FALSE; |
900 | 896 | } |
901 | 897 | |
@@ -933,8 +929,7 @@ discard block |
||
933 | 929 | ); |
934 | 930 | $where[] = 'n.title '. (isset($match_clauses[$match]) ? $match_clauses[$match] : $match_clauses['contains']); |
935 | 931 | $args[] = $string; |
936 | - } |
|
937 | - elseif ($ids) { |
|
932 | + } elseif ($ids) { |
|
938 | 933 | $where[] = 'n.nid IN (' . db_placeholders($ids) . ')'; |
939 | 934 | $args = array_merge($args, $ids); |
940 | 935 | } |
@@ -133,8 +133,7 @@ discard block |
||
133 | 133 | '#rows' => 6, |
134 | 134 | '#description' => t('Advanced usage only: PHP code that returns a keyed array of allowed values. Should not include <?php ?> delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'), |
135 | 135 | ); |
136 | - } |
|
137 | - else { |
|
136 | + } else { |
|
138 | 137 | $form['allowed_values_fieldset']['advanced_options']['markup_allowed_values_php'] = array( |
139 | 138 | '#type' => 'item', |
140 | 139 | '#title' => t('Code'), |
@@ -217,7 +216,9 @@ discard block |
||
217 | 216 | if (is_array($items)) { |
218 | 217 | foreach ($items as $delta => $item) { |
219 | 218 | $error_element = isset($item['_error_element']) ? $item['_error_element'] : ''; |
220 | - if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']); |
|
219 | + if (is_array($item) && isset($item['_error_element'])) { |
|
220 | + unset($item['_error_element']); |
|
221 | + } |
|
221 | 222 | if ($item['value'] != '') { |
222 | 223 | if (is_numeric($field['min']) && $item['value'] < $field['min']) { |
223 | 224 | form_set_error($error_element, t('%name: the value may be no smaller than %min.', array('%name' => t($field['widget']['label']), '%min' => $field['min']))); |
@@ -514,8 +515,7 @@ discard block |
||
514 | 515 | if ($start != $value) { |
515 | 516 | $error_field = implode('][', $element['#parents']) .']['. $field_key; |
516 | 517 | form_set_error($error_field, t('Only numbers and decimals are allowed in %field.', array('%field' => t($field['widget']['label'])))); |
517 | - } |
|
518 | - else { |
|
518 | + } else { |
|
519 | 519 | form_set_value($element[$field_key], $value, $form_state); |
520 | 520 | } |
521 | 521 | } |
@@ -537,8 +537,7 @@ discard block |
||
537 | 537 | if ($start != $value) { |
538 | 538 | $error_field = implode('][', $element['#parents']) .']['. $field_key; |
539 | 539 | form_set_error($error_field, t('Only numbers are allowed in %field.', array('%field' => t($field['widget']['label'])))); |
540 | - } |
|
541 | - else { |
|
540 | + } else { |
|
542 | 541 | form_set_value($element[$field_key], $value, $form_state); |
543 | 542 | } |
544 | 543 | } |
@@ -561,8 +560,7 @@ discard block |
||
561 | 560 | if ($start != $value) { |
562 | 561 | $error_field = implode('][', $element['#parents']) .']['. $field_key; |
563 | 562 | form_set_error($error_field, t('Only numbers and the decimal character (%decimal) are allowed in %field.', array('%decimal' => $element['#decimal'], '%field' => t($field['widget']['label'])))); |
564 | - } |
|
565 | - else { |
|
563 | + } else { |
|
566 | 564 | $value = str_replace($element['#decimal'], '.', $value); |
567 | 565 | $value = round($value, $element['#scale']); |
568 | 566 | form_set_value($element[$field_key], $value, $form_state); |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | if ($widget_type == 'optionwidgets_onoff') { |
22 | 22 | $output .= '<p>'. t("For a 'single on/off checkbox' widget, define the 'off' value first, then the 'on' value in the <strong>Allowed values</strong> section. Note that the checkbox will be labeled with the label of the 'on' value.") .'</p>'; |
23 | - } |
|
24 | - elseif ($widget_type == 'optionwidgets_buttons') { |
|
23 | + } elseif ($widget_type == 'optionwidgets_buttons') { |
|
25 | 24 | $output .= '<p>'. t("The 'checkboxes/radio buttons' widget will display checkboxes if the multiple values option is selected for this field, otherwise radios will be displayed.") .'</p>'; |
26 | 25 | } |
27 | 26 | |
@@ -355,8 +354,7 @@ discard block |
||
355 | 354 | } |
356 | 355 | if ($field['multiple'] || $element['#type'] == 'optionwidgets_onoff') { |
357 | 356 | return array($field_key => $keys); |
358 | - } |
|
359 | - else { |
|
357 | + } else { |
|
360 | 358 | return !empty($keys) ? array($field_key => $value) : array(); |
361 | 359 | } |
362 | 360 | } |
@@ -374,8 +374,7 @@ discard block |
||
374 | 374 | $imported_groups = array(); |
375 | 375 | if (isset($content['groups']) && module_exists('fieldgroup')) { |
376 | 376 | $imported_groups = (array) $content['groups']; |
377 | - } |
|
378 | - elseif (isset($content['groups']) && is_array($content['groups'])) { |
|
377 | + } elseif (isset($content['groups']) && is_array($content['groups'])) { |
|
379 | 378 | $not_enabled[] = 'fieldgroup'; |
380 | 379 | } |
381 | 380 | |
@@ -384,8 +383,7 @@ discard block |
||
384 | 383 | $field = content_field_instance_collapse($import); |
385 | 384 | if (empty($field['module']) || empty($field['widget_module'])) { |
386 | 385 | $not_enabled[] = $field['field_name']; |
387 | - } |
|
388 | - else { |
|
386 | + } else { |
|
389 | 387 | if (!module_exists($field['module'])) { |
390 | 388 | $not_enabled[] = $field['module']; |
391 | 389 | } |
@@ -466,8 +464,7 @@ discard block |
||
466 | 464 | if (!empty($field['field_name']) && isset($content_info['content types'][$type_name]['fields'][$field_name])) { |
467 | 465 | drupal_set_message(t('The imported field %field_label (%field_name) was not added to %type because that field already exists in %type.', array( |
468 | 466 | '%field_label' => $field['label'], '%field_name' => $field_name, '%type' => $type_label))); |
469 | - } |
|
470 | - else { |
|
467 | + } else { |
|
471 | 468 | $field = content_field_instance_create($field, FALSE); |
472 | 469 | $rebuild = TRUE; |
473 | 470 | drupal_set_message(t('The field %field_label (%field_name) was added to the content type %type.', array( |
@@ -573,8 +570,7 @@ discard block |
||
573 | 570 | if (isset($edit['field_widget_type'])) { |
574 | 571 | $tmp = explode('-', $edit['field_widget_type']); |
575 | 572 | $field_name = $tmp[0]; |
576 | - } |
|
577 | - else { |
|
573 | + } else { |
|
578 | 574 | $field_name = isset($edit['field_name']) ? $edit['field_name'] : ''; |
579 | 575 | } |
580 | 576 | |
@@ -590,8 +586,7 @@ discard block |
||
590 | 586 | '%field_name' => $field_name, |
591 | 587 | '%db_err' => $db_err |
592 | 588 | ))); |
593 | - } |
|
594 | - else { |
|
589 | + } else { |
|
595 | 590 | // The db fetch occurred successfully, unserialize the data blob and |
596 | 591 | // insert it into a new "display_settings" field of the data. |
597 | 592 | if ($display_settings = unserialize($row_info['display_settings'])) { |
@@ -95,8 +95,7 @@ discard block |
||
95 | 95 | '#rows' => 6, |
96 | 96 | '#description' => t('Advanced usage only: PHP code that returns a keyed array of allowed values. Should not include <?php ?> delimiters. If this field is filled out, the array returned by this code will override the allowed values list above.'), |
97 | 97 | ); |
98 | - } |
|
99 | - else { |
|
98 | + } else { |
|
100 | 99 | $form['allowed_values_fieldset']['advanced_options']['markup_allowed_values_php'] = array( |
101 | 100 | '#type' => 'item', |
102 | 101 | '#title' => t('Code'), |
@@ -112,8 +111,7 @@ discard block |
||
112 | 111 | case 'database columns': |
113 | 112 | if (empty($field['max_length']) || $field['max_length'] > 255) { |
114 | 113 | $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE); |
115 | - } |
|
116 | - else { |
|
114 | + } else { |
|
117 | 115 | $columns['value'] = array('type' => 'varchar', 'length' => $field['max_length'], 'not null' => FALSE, 'sortable' => TRUE, 'views' => TRUE); |
118 | 116 | } |
119 | 117 | if (!empty($field['text_processing'])) { |
@@ -151,7 +149,9 @@ discard block |
||
151 | 149 | if (is_array($items)) { |
152 | 150 | foreach ($items as $delta => $item) { |
153 | 151 | $error_element = isset($item['_error_element']) ? $item['_error_element'] : ''; |
154 | - if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']); |
|
152 | + if (is_array($item) && isset($item['_error_element'])) { |
|
153 | + unset($item['_error_element']); |
|
154 | + } |
|
155 | 155 | if (!empty($item['value'])) { |
156 | 156 | if (count($allowed_values) && !array_key_exists($item['value'], $allowed_values)) { |
157 | 157 | form_set_error($error_element, t('%name: illegal value.', array('%name' => t($field['widget']['label'])))); |
@@ -168,8 +168,7 @@ discard block |
||
168 | 168 | foreach ($items as $delta => $item) { |
169 | 169 | if (!empty($field['text_processing'])) { |
170 | 170 | $text = isset($item['value']) ? check_markup($item['value'], $item['format'], FALSE) : ''; |
171 | - } |
|
172 | - else { |
|
171 | + } else { |
|
173 | 172 | $text = isset($item['value']) ? check_plain($item['value']) : ''; |
174 | 173 | } |
175 | 174 | $items[$delta]['safe'] = $text; |
@@ -318,8 +317,7 @@ discard block |
||
318 | 317 | '#element_validate' => array('_element_validate_integer_positive'), |
319 | 318 | '#required' => TRUE, |
320 | 319 | ); |
321 | - } |
|
322 | - else { |
|
320 | + } else { |
|
323 | 321 | $form['rows'] = array( |
324 | 322 | '#type' => 'textfield', |
325 | 323 | '#title' => t('Rows'), |
@@ -92,8 +92,7 @@ discard block |
||
92 | 92 | if ($view->base_table == 'users' && !empty($view->display['default']->display_options['fields'])) { |
93 | 93 | if ($view->type == 'Default') { |
94 | 94 | $views[t('Default Views')][$view->name] = $view->name; |
95 | - } |
|
96 | - else { |
|
95 | + } else { |
|
97 | 96 | $views[t('Existing Views')][$view->name] = $view->name; |
98 | 97 | } |
99 | 98 | } |
@@ -121,8 +120,7 @@ discard block |
||
121 | 120 | '#required' => FALSE, |
122 | 121 | '#description' => t('Provide a comma separated list of arguments to pass to the view.'), |
123 | 122 | ); |
124 | - } |
|
125 | - else { |
|
123 | + } else { |
|
126 | 124 | $form['advanced']['no_view_help'] = array( |
127 | 125 | '#value' => t('<p>The list of user that can be referenced can be based on a "Views module" view but no appropriate views were found. <br />Note:</p>') . |
128 | 126 | t('<ul><li>Only views that have fields will work for this purpose.</li><li>This will discard the "Referenceable Roles" and "Referenceable Status" settings above. Use the view\'s "filters" section instead.</li><li>Use the view\'s "fields" section to display additional informations about candidate users on user creation/edition form.</li><li>Use the view\'s "sort criteria" section to determine the order in which candidate users will be displayed.</li></ul>'), |
@@ -188,10 +186,11 @@ discard block |
||
188 | 186 | if (is_array($item) && !empty($item['uid'])) { |
189 | 187 | if (is_numeric($item['uid'])) { |
190 | 188 | $ids[] = $item['uid']; |
191 | - } |
|
192 | - else { |
|
189 | + } else { |
|
193 | 190 | $error_element = isset($item['_error_element']) ? $item['_error_element'] : ''; |
194 | - if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']); |
|
191 | + if (is_array($item) && isset($item['_error_element'])) { |
|
192 | + unset($item['_error_element']); |
|
193 | + } |
|
195 | 194 | form_set_error($error_element, t('%name: invalid input.', array('%name' => t($field['widget']['label'])))); |
196 | 195 | } |
197 | 196 | } |
@@ -202,7 +201,9 @@ discard block |
||
202 | 201 | foreach ($items as $delta => $item) { |
203 | 202 | if (is_array($item)) { |
204 | 203 | $error_element = isset($item['_error_element']) ? $item['_error_element'] : ''; |
205 | - if (is_array($item) && isset($item['_error_element'])) unset($item['_error_element']); |
|
204 | + if (is_array($item) && isset($item['_error_element'])) { |
|
205 | + unset($item['_error_element']); |
|
206 | + } |
|
206 | 207 | if (!empty($item['uid']) && !isset($refs[$item['uid']])) { |
207 | 208 | form_set_error($error_element, t('%name: invalid user.', array('%name' => t($field['widget']['label'])))); |
208 | 209 | } |
@@ -367,8 +368,7 @@ discard block |
||
367 | 368 | '#element_validate' => array('_element_validate_integer_positive'), |
368 | 369 | '#required' => TRUE, |
369 | 370 | ); |
370 | - } |
|
371 | - else { |
|
371 | + } else { |
|
372 | 372 | $form['autocomplete_match'] = array('#type' => 'hidden', '#value' => $match); |
373 | 373 | $form['size'] = array('#type' => 'hidden', '#value' => $size); |
374 | 374 | } |
@@ -612,8 +612,7 @@ discard block |
||
612 | 612 | $reference = _userreference_potential_references($field, $value, 'equals', NULL, 1); |
613 | 613 | if (empty($reference)) { |
614 | 614 | form_error($element[$field_key], t('%name: found no valid user with that name.', array('%name' => t($field['widget']['label'])))); |
615 | - } |
|
616 | - else { |
|
615 | + } else { |
|
617 | 616 | $uid = key($reference); |
618 | 617 | } |
619 | 618 | } |
@@ -733,8 +732,7 @@ discard block |
||
733 | 732 | if (!empty($field['advanced_view_args'])) { |
734 | 733 | // TODO: Support Tokens using token.module ? |
735 | 734 | $view_args = array_map('trim', explode(',', $field['advanced_view_args'])); |
736 | - } |
|
737 | - else { |
|
735 | + } else { |
|
738 | 736 | $view_args = array(); |
739 | 737 | } |
740 | 738 | |
@@ -759,8 +757,7 @@ discard block |
||
759 | 757 | |
760 | 758 | // Get the results. |
761 | 759 | $result = $view->execute_display($display, $view_args); |
762 | - } |
|
763 | - else { |
|
760 | + } else { |
|
764 | 761 | $result = FALSE; |
765 | 762 | } |
766 | 763 | |
@@ -785,12 +782,10 @@ discard block |
||
785 | 782 | ); |
786 | 783 | $where[] = 'u.name '. (isset($match_clauses[$match]) ? $match_clauses[$match] : $match_clauses['contains']); |
787 | 784 | $args[] = $string; |
788 | - } |
|
789 | - elseif ($ids) { |
|
785 | + } elseif ($ids) { |
|
790 | 786 | $where[] = 'u.uid IN (' . db_placeholders($ids) . ')'; |
791 | 787 | $args = array_merge($args, $ids); |
792 | - } |
|
793 | - else { |
|
788 | + } else { |
|
794 | 789 | $where[] = "u.uid > 0"; |
795 | 790 | } |
796 | 791 |