@@ -45,8 +45,7 @@ |
||
45 | 45 | $view->display[$display]->display_options['fields'][$views_field['field']]['format'] = $views_field['options']; |
46 | 46 | if ($views_field['handler'] == 'content_views_field_handler_group') { |
47 | 47 | $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 1; |
48 | - } |
|
49 | - else { |
|
48 | + } else { |
|
50 | 49 | $view->display[$display]->display_options['fields'][$views_field['field']]['multiple']['group'] = 0; |
51 | 50 | } |
52 | 51 | return; |
@@ -252,8 +252,7 @@ |
||
252 | 252 | if ($db_fields_count == 1) { |
253 | 253 | $title = t('@label (!name)', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'])); |
254 | 254 | $title_short = check_plain($label_truncated); |
255 | - } |
|
256 | - else { |
|
255 | + } else { |
|
257 | 256 | $title = t('@label (!name) - !column', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'], '!column' => $columns[$i])); |
258 | 257 | $title_short = t('@label-truncated - !column', array('@label-truncated' => $label_truncated, '!column' => $columns[$i])); |
259 | 258 | } |
@@ -32,8 +32,7 @@ |
||
32 | 32 | // For selects, HTML should be filtered out and entities left unencoded. |
33 | 33 | // See content_allowed_values / content_filter_xss / filter_xss. |
34 | 34 | content_allowed_values_filter_html($options); |
35 | - } |
|
36 | - else { |
|
35 | + } else { |
|
37 | 36 | $options = function_exists($function) ? $function($field) : content_allowed_values($field); |
38 | 37 | } |
39 | 38 | return (array) $options; |
@@ -20,8 +20,7 @@ |
||
20 | 20 | $value = $data->{$this->name_alias}; |
21 | 21 | if (isset($options[$value])) { |
22 | 22 | $value = $options[$value]; |
23 | - } |
|
24 | - else { |
|
23 | + } else { |
|
25 | 24 | $value = parent::summary_name($data); |
26 | 25 | } |
27 | 26 |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | ); |
30 | 30 | if ($view->base_table == 'node_revisions') { |
31 | 31 | $this->additional_fields['vid'] = array('table' => 'node_revisions', 'field' => 'vid'); |
32 | - } |
|
33 | - else { |
|
32 | + } else { |
|
34 | 33 | $this->additional_fields['vid'] = array('table' => 'node', 'field' => 'vid'); |
35 | 34 | } |
36 | 35 | } |
@@ -245,8 +244,7 @@ discard block |
||
245 | 244 | $nid = $item['_nid']; |
246 | 245 | unset($item['_nid']); |
247 | 246 | $items[] = $item; |
248 | - } |
|
249 | - else { |
|
247 | + } else { |
|
250 | 248 | break; |
251 | 249 | } |
252 | 250 | } |
@@ -276,8 +274,7 @@ discard block |
||
276 | 274 | $rendered[] = $this->render_link($output, (object) array('nid' => $nid)); |
277 | 275 | } |
278 | 276 | } |
279 | - } |
|
280 | - else { |
|
277 | + } else { |
|
281 | 278 | // Multiple values formatter. |
282 | 279 | $output = content_format($field, $items, $formatter_name, $values); |
283 | 280 | if (!empty($output)) { |
@@ -288,8 +285,7 @@ discard block |
||
288 | 285 | if (count($rendered) > 1) { |
289 | 286 | // TODO: could we use generic field display ? |
290 | 287 | return theme('content_view_multiple_field', $rendered, $field, $values); |
291 | - } |
|
292 | - elseif ($rendered) { |
|
288 | + } elseif ($rendered) { |
|
293 | 289 | return $rendered[0]; |
294 | 290 | } |
295 | 291 | } |
@@ -308,13 +304,11 @@ discard block |
||
308 | 304 | // Views 2.3+ |
309 | 305 | $this->options['alter']['make_link'] = TRUE; |
310 | 306 | $this->options['alter']['path'] = "node/" . $values->{$this->aliases['nid']}; |
311 | - } |
|
312 | - else { |
|
307 | + } else { |
|
313 | 308 | // Views up to 2.2 |
314 | 309 | return l($data, "node/" . $values->nid, array('html' => TRUE)); |
315 | 310 | } |
316 | - } |
|
317 | - else { |
|
311 | + } else { |
|
318 | 312 | return $data; |
319 | 313 | } |
320 | 314 | } |
@@ -33,8 +33,7 @@ |
||
33 | 33 | $clause = isset($match_clauses[$options['match']]) ? $match_clauses[$options['match']] : $match_clauses['contains']; |
34 | 34 | $alias = $this->view->query->ensure_table($options['table']); |
35 | 35 | $this->view->query->add_where(NULL, "$alias.$options[field_string] $clause", $options['string']); |
36 | - } |
|
37 | - elseif ($options['ids']) { |
|
36 | + } elseif ($options['ids']) { |
|
38 | 37 | $alias = $this->view->query->ensure_table($options['table']); |
39 | 38 | $this->view->query->add_where(NULL, "$alias.$options[field_id] IN (" . db_placeholders($options['ids']) . ')', $options['ids']); |
40 | 39 | } |
@@ -160,8 +160,7 @@ discard block |
||
160 | 160 | // about won't end up wrapping a span around a block-level element. |
161 | 161 | if ($this->content_field['widget']['type'] == 'text_textarea') { |
162 | 162 | return 'div'; |
163 | - } |
|
164 | - else { |
|
163 | + } else { |
|
165 | 164 | return 'span'; |
166 | 165 | } |
167 | 166 | } |
@@ -216,8 +215,7 @@ discard block |
||
216 | 215 | if (content_handle('formatter', 'multiple values', $formatter) == CONTENT_HANDLE_CORE) { |
217 | 216 | // Single-value formatter. |
218 | 217 | $output = content_format($field, $item, $formatter_name, $node); |
219 | - } |
|
220 | - else { |
|
218 | + } else { |
|
221 | 219 | // Multiple values formatter - we actually have only one value to display. |
222 | 220 | $output = content_format($field, array($item), $formatter_name, $node); |
223 | 221 | } |
@@ -34,8 +34,7 @@ discard block |
||
34 | 34 | // Set the delete column. |
35 | 35 | if ($type->custom) { |
36 | 36 | $row[] = array('data' => l(t('delete'), 'admin/content/node-type/'. $type_url_str .'/delete')); |
37 | - } |
|
38 | - else { |
|
37 | + } else { |
|
39 | 38 | $row[] = array('data' => ''); |
40 | 39 | } |
41 | 40 | |
@@ -94,8 +93,7 @@ discard block |
||
94 | 93 | } |
95 | 94 | if (empty($rows)) { |
96 | 95 | $output = t('No fields have been defined for any content type yet.'); |
97 | - } |
|
98 | - else { |
|
96 | + } else { |
|
99 | 97 | $output = theme('table', $header, $rows); |
100 | 98 | } |
101 | 99 | return $output; |
@@ -496,16 +494,14 @@ discard block |
||
496 | 494 | if (in_array($key, $form['#fields'])) { |
497 | 495 | db_query("UPDATE {". content_instance_tablename() ."} SET weight = %d WHERE type_name = '%s' AND field_name = '%s'", |
498 | 496 | $values['weight'], $type_name, $key); |
499 | - } |
|
500 | - elseif (in_array($key, $form['#extra'])) { |
|
497 | + } elseif (in_array($key, $form['#extra'])) { |
|
501 | 498 | $extra[$key] = $values['weight']; |
502 | 499 | } |
503 | 500 | } |
504 | 501 | |
505 | 502 | if ($extra) { |
506 | 503 | variable_set('content_extra_weights_'. $type_name, $extra); |
507 | - } |
|
508 | - else { |
|
504 | + } else { |
|
509 | 505 | variable_del('content_extra_weights_'. $type_name); |
510 | 506 | } |
511 | 507 | |
@@ -523,8 +519,7 @@ discard block |
||
523 | 519 | // Store new field information for fieldgroup submit handler. |
524 | 520 | $form_state['fields_added']['_add_new_field'] = $field['field_name']; |
525 | 521 | $destinations[] = 'admin/content/node-type/'. $type['url_str'] .'/fields/'. $field['field_name']; |
526 | - } |
|
527 | - else { |
|
522 | + } else { |
|
528 | 523 | drupal_set_message(t('There was a problem creating field %label.', array( |
529 | 524 | '%label' => $field['label']))); |
530 | 525 | } |
@@ -538,15 +533,13 @@ discard block |
||
538 | 533 | |
539 | 534 | if ($existing_field['locked']) { |
540 | 535 | drupal_set_message(t('The field %label cannot be added to a content type because it is locked.', array('%label' => $field['field_name']))); |
541 | - } |
|
542 | - else { |
|
536 | + } else { |
|
543 | 537 | module_load_include('inc', 'content', 'includes/content.crud'); |
544 | 538 | if (content_field_instance_create($field)) { |
545 | 539 | // Store new field information for fieldgroup submit handler. |
546 | 540 | $form_state['fields_added']['_add_existing_field'] = $field['field_name']; |
547 | 541 | $destinations[] = 'admin/content/node-type/'. $type['url_str'] .'/fields/'. $field['field_name']; |
548 | - } |
|
549 | - else { |
|
542 | + } else { |
|
550 | 543 | drupal_set_message(t('There was a problem adding field %label.', array('%label' => $field['field_name']))); |
551 | 544 | } |
552 | 545 | } |
@@ -756,16 +749,14 @@ discard block |
||
756 | 749 | |
757 | 750 | if ($field_type) { |
758 | 751 | return !empty($options[$field_type]) ? $options[$field_type] : array(); |
759 | - } |
|
760 | - elseif ($by_label) { |
|
752 | + } elseif ($by_label) { |
|
761 | 753 | $field_types = _content_field_types(); |
762 | 754 | $options_by_label = array(); |
763 | 755 | foreach ($options as $field_type => $widgets) { |
764 | 756 | $options_by_label[t($field_types[$field_type]['label'])] = $widgets; |
765 | 757 | } |
766 | 758 | return $options_by_label; |
767 | - } |
|
768 | - else { |
|
759 | + } else { |
|
769 | 760 | return $options; |
770 | 761 | } |
771 | 762 | } |
@@ -878,8 +869,7 @@ discard block |
||
878 | 869 | if (content_field_instance_update($field)) { |
879 | 870 | drupal_set_message(t('Updated basic settings for field %label.', array( |
880 | 871 | '%label' => $label))); |
881 | - } |
|
882 | - else { |
|
872 | + } else { |
|
883 | 873 | drupal_set_message(t('There was a problem updating the basic settings for field %label.', array( |
884 | 874 | '%label' => $label))); |
885 | 875 | } |
@@ -940,8 +930,7 @@ discard block |
||
940 | 930 | drupal_set_message(t('Removed field %field from %type.', array( |
941 | 931 | '%field' => $field['widget']['label'], |
942 | 932 | '%type' => $type['name']))); |
943 | - } |
|
944 | - else { |
|
933 | + } else { |
|
945 | 934 | drupal_set_message(t('There was a problem deleting %field from %type.', array( |
946 | 935 | '%field' => $field['widget']['label'], |
947 | 936 | '%type' => $type['name']))); |
@@ -1122,8 +1111,7 @@ discard block |
||
1122 | 1111 | '@link_devel' => 'http://www.drupal.org/project/devel', |
1123 | 1112 | '%type' => $type_name)), |
1124 | 1113 | ); |
1125 | - } |
|
1126 | - else { |
|
1114 | + } else { |
|
1127 | 1115 | $form['widget']['default_value_fieldset']['advanced_options']['markup_default_value_php'] = array( |
1128 | 1116 | '#type' => 'item', |
1129 | 1117 | '#title' => t('Code'), |
@@ -1248,8 +1236,7 @@ discard block |
||
1248 | 1236 | ob_end_clean(); |
1249 | 1237 | if (!is_array($return)) { |
1250 | 1238 | $error = TRUE; |
1251 | - } |
|
1252 | - else { |
|
1239 | + } else { |
|
1253 | 1240 | foreach ($return as $item) { |
1254 | 1241 | if (!is_array($item)) { |
1255 | 1242 | $error = TRUE; |
@@ -1269,15 +1256,13 @@ discard block |
||
1269 | 1256 | '!sample' => $sample, |
1270 | 1257 | '@value' => print_r($return, TRUE)))); |
1271 | 1258 | return; |
1272 | - } |
|
1273 | - else { |
|
1259 | + } else { |
|
1274 | 1260 | $default_value = $return; |
1275 | 1261 | $is_code = TRUE; |
1276 | 1262 | form_set_value(array('#parents' => array('default_value_php')), $php, $form_state); |
1277 | 1263 | form_set_value(array('#parents' => array('default_value')), array(), $form_state); |
1278 | 1264 | } |
1279 | - } |
|
1280 | - elseif (!empty($form_values['default_value_widget'])) { |
|
1265 | + } elseif (!empty($form_values['default_value_widget'])) { |
|
1281 | 1266 | // Fields that handle their own multiple values may use an expected |
1282 | 1267 | // value as the top-level key, so just pop off the top element. |
1283 | 1268 | $key = array_shift(array_keys($form_values['default_value_widget'])); |
@@ -1306,8 +1291,7 @@ discard block |
||
1306 | 1291 | if (trim($form_values['default_value_php'])) { |
1307 | 1292 | form_set_error('default_value_php', t("The PHP code for 'default value' returned @value, which is invalid.", array( |
1308 | 1293 | '@value' => print_r($default_value, TRUE)))); |
1309 | - } |
|
1310 | - else { |
|
1294 | + } else { |
|
1311 | 1295 | form_set_error('default_value', t('The default value is invalid.')); |
1312 | 1296 | } |
1313 | 1297 | } |
@@ -1337,8 +1321,7 @@ discard block |
||
1337 | 1321 | if ($destinations) { |
1338 | 1322 | drupal_set_message(t('Added field %label.', array('%label' => $form_values['label']))); |
1339 | 1323 | $form_state['redirect'] = content_get_destinations($destinations); |
1340 | - } |
|
1341 | - else { |
|
1324 | + } else { |
|
1342 | 1325 | drupal_set_message(t('Saved field %label.', array('%label' => $form_values['label']))); |
1343 | 1326 | $type = content_types($form_values['type_name']); |
1344 | 1327 | $form_state['redirect'] = 'admin/content/node-type/'. $type['url_str'] .'/fields'; |
@@ -1455,8 +1438,7 @@ discard block |
||
1455 | 1438 | if (empty($new_field)) { |
1456 | 1439 | if ($previous_field['db_storage'] == CONTENT_DB_STORAGE_PER_FIELD) { |
1457 | 1440 | db_drop_table($ret, $previous_table); |
1458 | - } |
|
1459 | - else { |
|
1441 | + } else { |
|
1460 | 1442 | foreach ($previous_schema['fields'] as $column => $attributes) { |
1461 | 1443 | if (!in_array($column, array('nid', 'vid', 'delta'))) { |
1462 | 1444 | db_drop_field($ret, $previous_table, $column); |
@@ -1478,8 +1460,7 @@ discard block |
||
1478 | 1460 | // Create new table and columns, if not already created. |
1479 | 1461 | if (!db_table_exists($new_table)) { |
1480 | 1462 | db_create_table($ret, $new_table, $new_schema); |
1481 | - } |
|
1482 | - else { |
|
1463 | + } else { |
|
1483 | 1464 | // Or add fields and/or indexes to an existing table. |
1484 | 1465 | foreach ($new_schema['fields'] as $column => $attributes) { |
1485 | 1466 | if (!in_array($column, array('nid', 'vid', 'delta'))) { |
@@ -1530,8 +1511,7 @@ discard block |
||
1530 | 1511 | db_drop_field($ret, $new_table, 'delta'); |
1531 | 1512 | db_drop_primary_key($ret, $new_table); |
1532 | 1513 | db_add_primary_key($ret, $new_table, array('vid')); |
1533 | - } |
|
1534 | - else if ($previous_field['multiple'] == 0 && $new_field['multiple'] > 0) { |
|
1514 | + } else if ($previous_field['multiple'] == 0 && $new_field['multiple'] > 0) { |
|
1535 | 1515 | db_add_field($ret, $new_table, 'delta', array( |
1536 | 1516 | 'type' => 'int', |
1537 | 1517 | 'unsigned' => TRUE, |
@@ -1550,8 +1530,7 @@ discard block |
||
1550 | 1530 | if ($new_field['multiple']) { |
1551 | 1531 | db_query('INSERT INTO {'. $new_table .'} (vid, nid, delta, '. implode(', ', $columns) .') '. |
1552 | 1532 | ' SELECT vid, nid, 0, '. implode(', ', $columns) .' FROM {'. $previous_table .'}'); |
1553 | - } |
|
1554 | - else { |
|
1533 | + } else { |
|
1555 | 1534 | db_query('INSERT INTO {'. $new_table .'} (vid, nid, '. implode(', ', $columns) .') '. |
1556 | 1535 | ' SELECT vid, nid, '. implode(', ', $columns) .' FROM {'. $previous_table .'}'); |
1557 | 1536 | } |
@@ -1568,8 +1547,7 @@ discard block |
||
1568 | 1547 | content_alter_db_cleanup(); |
1569 | 1548 | if ($previous_field['multiple']) { |
1570 | 1549 | $result = db_query("SELECT * FROM {". $previous_table ."} c JOIN {node} n ON c.nid = n.nid WHERE delta = 0 AND n.type = '%s'", $new_field['type_name']); |
1571 | - } |
|
1572 | - else { |
|
1550 | + } else { |
|
1573 | 1551 | $result = db_query("SELECT * FROM {". $previous_table ."} c JOIN {node} n ON c.nid = n.nid WHERE n.type = '%s'", $new_field['type_name']); |
1574 | 1552 | } |
1575 | 1553 | $record = array(); |
@@ -1582,8 +1560,7 @@ discard block |
||
1582 | 1560 | foreach ($migrate_columns as $column => $attributes) { |
1583 | 1561 | if (is_null($data[$column])) { |
1584 | 1562 | $record[$column] = NULL; |
1585 | - } |
|
1586 | - else { |
|
1563 | + } else { |
|
1587 | 1564 | $record[$column] = $data[$column]; |
1588 | 1565 | // Prevent double serializtion in drupal_write_record. |
1589 | 1566 | if (isset($attributes['serialize']) && $attributes['serialize']) { |
@@ -1595,8 +1572,7 @@ discard block |
||
1595 | 1572 | '} WHERE vid = %d AND nid = %d', $data['vid'], $data['nid']))) { |
1596 | 1573 | $keys = $new_field['multiple'] ? array('vid', 'delta') : array('vid'); |
1597 | 1574 | drupal_write_record($new_table, $record, $keys); |
1598 | - } |
|
1599 | - else { |
|
1575 | + } else { |
|
1600 | 1576 | drupal_write_record($new_table, $record); |
1601 | 1577 | } |
1602 | 1578 | } |
@@ -1720,8 +1696,7 @@ discard block |
||
1720 | 1696 | function _content_alter_fields_finished($success, $results, $operations) { |
1721 | 1697 | if ($success) { |
1722 | 1698 | drupal_set_message(t('The database has been altered and data has been migrated or deleted.')); |
1723 | - } |
|
1724 | - else { |
|
1699 | + } else { |
|
1725 | 1700 | drupal_set_message(t('An error occurred and database alteration did not complete.'), 'error'); |
1726 | 1701 | $message = format_plural(count($results), '1 item successfully processed:', '@count items successfully processed:'); |
1727 | 1702 | $message .= theme('item_list', $results); |
@@ -58,11 +58,9 @@ discard block |
||
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 |
||
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 |
||
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 |