Issue #2950316 by drupalgin: Fixed coding standards

This commit is contained in:
drupalgin 2018-04-07 12:37:44 -04:00 committed by Michael Stenta
parent 25a9694301
commit 0e5a226627
22 changed files with 38 additions and 31 deletions

View File

@ -73,7 +73,7 @@ function farm_install_configure_form($form, &$form_state) {
'farm_sensor' => st('Sensor'),
'farm_sensor_listener' => st('Sensor: Listener'),
'farm_log_sale' => st('Sale logs (beta)'),
'farm_quantity_report' => st('Quantity report generator (beta)')
'farm_quantity_report' => st('Quantity report generator (beta)'),
);
$form['farm_modules'] = array(
'#type' => 'checkboxes',
@ -572,7 +572,7 @@ function farm_update_7025(&$sandbox) {
'farm_help',
'farm_menu',
'farm_people',
'farm_ui'
'farm_ui',
);
_farm_update_enable_modules($modules);

View File

@ -95,7 +95,7 @@ function farm_area_default_openlayers_layers() {
'visible' => 1,
'grouptitle' => 'Areas layer',
'grouplayers' => array(
'farm_area_layer_areas'
'farm_area_layer_areas',
),
);
$export['farm_area_layer_areas_group'] = $ol_layer;

View File

@ -210,7 +210,7 @@ function farm_area_details_json($aid) {
function farm_area_openlayers_object_preprocess_alter(&$build, $context) {
// If the object is not a Map, bail.
if (!$context instanceof Drupal\openlayers\Types\MapInterface) {
if (!$context instanceof Drupal\openlayers\Types\MapInterface) {
return;
}
@ -335,7 +335,8 @@ function farm_area_calculate_area($area_id) {
// Get WKT from the field. If empty, bail.
if (!empty($area->field_farm_geofield[LANGUAGE_NONE][0]['geom'])) {
$geom = $area->field_farm_geofield[LANGUAGE_NONE][0]['geom'];
} else {
}
else {
return '';
}

View File

@ -416,7 +416,7 @@ function farm_area_generate_bbox_geometries($bbox, $count) {
$total_width = bcsub($bbox['maxy'], $bbox['miny']);
$geom_width = bcdiv($total_width, $count);
}
else{
else {
$total_width = $bbox['maxy'] - $bbox['miny'];
$geom_width = $total_width / $count;
}
@ -424,7 +424,7 @@ function farm_area_generate_bbox_geometries($bbox, $count) {
// Fill the bounding box with rectangles.
$geometries = array();
$starting_point = new Point($bbox['minx'], $bbox['maxy']);
for ($i=1;$i<=$count;$i++) {
for ($i = 1; $i <= $count; $i++) {
$points = array();
$points[] = $starting_point;
if (geoPHP::bcmathInstalled()) {

View File

@ -118,7 +118,8 @@ function farm_asset_type_form_delete_confirm(array $form, array &$form_state, $f
// Always provide entity id in the same form key as in the entity edit form.
$form['farm_asset_type_id'] = array(
'#type' => 'value',
'#value' => entity_id('farm_asset_type', $farm_asset_type));
'#value' => entity_id('farm_asset_type', $farm_asset_type),
);
return confirm_form($form,
t('Are you sure you want to delete asset type %title?', array('%title' => entity_label('farm_asset_type', $farm_asset_type))),
'farm/asset/' . entity_id('farm_asset_type', $farm_asset_type),

View File

@ -151,7 +151,7 @@ function farm_asset_menu() {
'page arguments' => array(2, 3),
'access callback' => 'farm_asset_autocomplete_access',
'access arguments' => array(2),
'type' => MENU_CALLBACK
'type' => MENU_CALLBACK,
);
return $items;
@ -329,7 +329,7 @@ function farm_asset_entity_view($entity, $type, $view_mode, $langcode) {
drupal_set_message(t('This asset is archived. Archived assets should not be edited or deleted unless they contain information that is incorrect.'), 'warning');
$date = format_date($entity->archived);
$entity->content['archived'] = array(
'#markup' => '<div><strong>'. t('Archived') . ':</strong> ' . $date . '</div>',
'#markup' => '<div><strong>' . t('Archived') . ':</strong> ' . $date . '</div>',
'#weight' => -100,
);
}

View File

@ -116,7 +116,7 @@ function farm_asset_form(array $form, array &$form_state, FarmAsset $farm_asset)
'#title' => t('Asset status'),
'#description' => t('Archive this asset. Archived assets will not show in most lists, but will be visible in archives.'),
'#collapsible' => TRUE,
'#group' => 'additional_settings'
'#group' => 'additional_settings',
);
$form['asset_status']['archived_boolean'] = array(
'#type' => 'checkbox',
@ -235,7 +235,8 @@ function farm_asset_delete_form(array $form, array &$form_state, FarmAsset $farm
// Always provide entity id in the same form key as in the entity edit form.
$form['farm_asset_type_id'] = array(
'#type' => 'value',
'#value' => entity_id('farm_asset', $farm_asset));
'#value' => entity_id('farm_asset', $farm_asset),
);
$farm_asset_uri = entity_uri('farm_asset', $farm_asset);
return confirm_form($form,
t('Are you sure you want to delete %title?', array('%title' => entity_label('farm_asset', $farm_asset))),

View File

@ -152,7 +152,7 @@ class FarmAssetProcessor extends FeedsProcessor {
'#title' => t('Author'),
'#description' => t('Select the author of the assets to be created. If this is left empty, they will be assigned to the user running the import, or "anonymous" in the case of automated imports.'),
'#autocomplete_path' => 'user/autocomplete',
'#default_value' => empty($author->name) ? '' : check_plain($author->name),
'#default_value' => empty($author->name) ? '' : check_plain($author->name),
);
$form['authorize'] = array(
'#type' => 'checkbox',

View File

@ -10,7 +10,7 @@
*
* @ingroup views_relationship_handlers
*/
class farm_asset_handler_relationship_entity_reverse extends views_handler_relationship_entity_reverse {
class farm_asset_handler_relationship_entity_reverse extends views_handler_relationship_entity_reverse {
function option_definition() {
$options = parent::option_definition();

View File

@ -190,7 +190,7 @@ function farm_group_form_farm_asset_form_alter(&$form, &$form_state, $form_id) {
$form['group']['create'] = array(
'#type' => 'textfield',
'#title' => t('Create a new group'),
'#description' => t('Optionally enter the name of a new group to be created. The assets will become members of this group.')
'#description' => t('Optionally enter the name of a new group to be created. The assets will become members of this group.'),
);
// Add validate and submit functions and put the fieldset into the general

View File

@ -78,7 +78,7 @@ function farm_help_farm_help_page() {
$output = array();
// Add general text.
$output[] = '<p>' . l('farmOS', 'http://farmos.org'). ' is built and maintained
$output[] = '<p>' . l('farmOS', 'http://farmos.org') . ' is built and maintained
by a community of volunteers. Some farmOS community resources are listed
below.</p>';

View File

@ -384,7 +384,7 @@ function _farm_livestock_update_7005_stage4(&$sandbox) {
// Iterate through the old group term IDs and add asset references to the
// new group assets that were created in stage 1 above.
foreach($old_group_ids as $delta => $old_group_id) {
foreach ($old_group_ids as $delta => $old_group_id) {
if (array_key_exists($old_group_id, $sandbox['groups'])) {
$group = farm_asset_load($sandbox['groups'][$old_group_id]);
if (!empty($group)) {

View File

@ -128,7 +128,8 @@ function farm_log_update_7001(&$sandbox) {
db_query('UPDATE {log} SET timestamp=:timestamp, done=:done WHERE id=:id', array(
':timestamp' => $row['timestamp'],
':done' => $row['done'],
':id' => $observation->id));
':id' => $observation->id,
));
}
}

View File

@ -371,13 +371,13 @@ function farm_map_distance($p1, $p2) {
if (geoPHP::bcmathInstalled()) {
$length = bcsqrt(
bcadd(
bcpow(bcmul(bcsub($p1->getX(),$p2->getX()), $lon_deg_len), '2'),
bcpow(bcmul(bcsub($p1->getX(), $p2->getX()), $lon_deg_len), '2'),
bcpow(bcmul(bcsub($p1->getY(), $p2->getY()), $lat_deg_len), '2')
)
);
}
else {
$length = sqrt(pow((($p1->getX() - $p2->getX()) * $lon_deg_len), 2) + pow((($p1->getY()- $p2->getY()) * $lat_deg_len), 2));
$length = sqrt(pow((($p1->getX() - $p2->getX()) * $lon_deg_len), 2) + pow((($p1->getY() - $p2->getY()) * $lat_deg_len), 2));
}
// Return the length as a string.

View File

@ -167,7 +167,7 @@ function farm_movement_update_7002(&$sandbox) {
$query->condition('fci.entity_type', 'log');
$query->condition('fci.bundle', $type);
$query->condition('fci.deleted', 0);
$log_fields[$type] = $query->execute()->fetchAllKeyed(0,0);
$log_fields[$type] = $query->execute()->fetchAllKeyed(0, 0);
}
$movement_only_fields = array_keys(array_diff($log_fields['farm_movement'], $log_fields['farm_activity']));
@ -207,7 +207,7 @@ function farm_movement_update_7003(&$sandbox) {
/**
* Delete the "Movement from" field from movement field collections.
*/
function farm_movement_update_7004 (&$sandbox) {
function farm_movement_update_7004(&$sandbox) {
$field = field_info_instance('field_collection_item', 'field_farm_move_from', 'field_farm_movement');
if (!empty($field)) {
field_delete_instance($field);

View File

@ -118,7 +118,8 @@ function farm_plan_type_form_delete_confirm(array $form, array &$form_state, $fa
// Always provide entity id in the same form key as in the entity edit form.
$form['farm_plan_type_id'] = array(
'#type' => 'value',
'#value' => entity_id('farm_plan_type', $farm_plan_type));
'#value' => entity_id('farm_plan_type', $farm_plan_type),
);
return confirm_form($form,
t('Are you sure you want to delete plan type %title?', array('%title' => entity_label('farm_plan_type', $farm_plan_type))),
'farm/plan/' . entity_id('farm_plan_type', $farm_plan_type),

View File

@ -113,7 +113,7 @@ function farm_plan_form(array $form, array &$form_state, FarmPlan $farm_plan) {
'#title' => t('Plan status'),
'#description' => t('Mark this plan as active/inactive. Inactive plans will not show in most lists, but will be visible in archives.'),
'#collapsible' => TRUE,
'#group' => 'additional_settings'
'#group' => 'additional_settings',
);
$form['plan_status']['active'] = array(
'#type' => 'checkbox',
@ -219,7 +219,8 @@ function farm_plan_delete_form(array $form, array &$form_state, FarmPlan $farm_p
// Always provide entity id in the same form key as in the entity edit form.
$form['farm_plan_type_id'] = array(
'#type' => 'value',
'#value' => entity_id('farm_plan', $farm_plan));
'#value' => entity_id('farm_plan', $farm_plan),
);
$farm_plan_uri = entity_uri('farm_plan', $farm_plan);
return confirm_form($form,
t('Are you sure you want to delete %title?', array('%title' => entity_label('farm_plan', $farm_plan))),

View File

@ -244,7 +244,7 @@ function farm_sensor_form_alter(&$form, &$form_state, $form_id) {
'#required' => TRUE,
'#ajax' => array(
'callback' => 'farm_sensor_settings_form_ajax',
'wrapper' => 'farm_sensor_settings'
'wrapper' => 'farm_sensor_settings',
),
);

View File

@ -110,7 +110,7 @@ function farm_sensor_listener_views_data() {
'filter' => array(
'handler' => 'fraction_handler_filter_decimal',
'additional fields' => $fraction_fields,
)
),
);
return $data;

View File

@ -24,7 +24,7 @@ function farm_soil_update_7000(&$sandbox) {
// Migrate terms.
$params = array(
'old_vid' => $old_vocab->vid,
'new_vid' => $new_vocab->vid
'new_vid' => $new_vocab->vid,
);
db_query('UPDATE {taxonomy_term_data} SET vid = :new_vid WHERE vid = :old_vid', $params);

View File

@ -65,7 +65,7 @@ function _farm_ui_views_post_render(&$view, &$output, &$cache) {
$fieldset = TRUE;
$collapsed = TRUE;
$map_build = farm_map_build('farm_assets_' . $bundle, $fieldset, $title, $collapsed);
$output = drupal_render($map_build) . $output;
$output = drupal_render($map_build) . $output;
}
/**

View File

@ -113,7 +113,8 @@ function farm_theme_form_views_exposed_form_alter(&$form, &$form_state, $form_id
if ($collapse) {
$collapse_class = '';
$aria_expanded = 'false';
} else {
}
else {
$collapse_class = ' in';
$aria_expanded = 'true';
}
@ -187,7 +188,7 @@ function farm_theme_views_bulk_operations_form_alter(&$form, &$form_state, $vbo)
'views_bulk_operations_config_form',
'views_bulk_operations_confirm_form',
);
if (!empty($form_state['step']) && in_array($form_state['step'], $vbo_steps)) {
if (!empty($form_state['step']) && in_array($form_state['step'], $vbo_steps)) {
// Set the title to '<none>' so that Views doesn't do drupal_set_title().
// See https://www.drupal.org/node/2905171.