@@ -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 | |
@@ -29,8 +29,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -109,8 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | if ($contexts_selector == 'basic') { |
| 111 | 111 | $help = t("Configure how this content type's fields and field labels should be displayed when it's viewed in teaser and full-page mode."); |
| 112 | - } |
|
| 113 | - else { |
|
| 112 | + } else { |
|
| 114 | 113 | $help = t("Configure how this content type's fields should be displayed when it's rendered in the following contexts."); |
| 115 | 114 | } |
| 116 | 115 | $help .= ' '. t("Use the 'Exclude' checkbox to exclude an item from the !content value passed to the node template.", array('!content' => '$content')); |
@@ -130,8 +129,7 @@ discard block |
||
| 130 | 129 | foreach (element_children($element) as $child) { |
| 131 | 130 | if (!array_key_exists('exclude', $element[$child])) { |
| 132 | 131 | $row->{$child} = drupal_render($element[$child]); |
| 133 | - } |
|
| 134 | - else { |
|
| 132 | + } else { |
|
| 135 | 133 | $row->{$child}->format = drupal_render($element[$child]['format']); |
| 136 | 134 | $row->{$child}->exclude = drupal_render($element[$child]['exclude']); |
| 137 | 135 | } |