Skip to content

Commit

Permalink
FOIA-238: WS-238 Updated codebase with new button to make clearing an…
Browse files Browse the repository at this point in the history
…d updating values easier.
  • Loading branch information
ameshkin committed Jul 31, 2023
1 parent eb752b5 commit c3065cd
Show file tree
Hide file tree
Showing 2 changed files with 483 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ function foia_annual_data_report_form_alter(&$form, FormStateInterface $form_sta
if (!in_array($key, $starting_fields)) {
$form[$key]['#access'] = FALSE;
}
}
else {
} else {
if (in_array($key, $hide_elements)) {
$form[$key]['#access'] = FALSE;
}
Expand All @@ -56,8 +55,7 @@ function foia_annual_data_report_form_alter(&$form, FormStateInterface $form_sta
$form['actions']['submit']['#value'] = 'Save and continue';
$form['actions']['preview']['#access'] = FALSE;
$form['#attached']['library'][] = 'foia_annual_data_report/foia_form_display_new_reports';
}
else {
} else {
// Add the javascript functionality (only needed for existing nodes).
$form['#attached']['library'][] = 'foia_annual_data_report/foia_change_report_agency';
}
Expand Down Expand Up @@ -237,8 +235,7 @@ function foia_annual_data_report_form_annual_data_report_section_validate(array
// Check if field is a selected paragraph field.
if (in_array($key, $paragraph_parent_fields)) {
_foia_annual_data_report_validate_paragraph_fields($form, $form_state, $key, $form_value, $paragraph_fields_for_validation);
}
else {
} else {

// Determine first if this is a subform of the field to be validated.
if (!empty($form_value['widget'][0]['subform'])) {
Expand Down Expand Up @@ -266,15 +263,14 @@ function foia_annual_data_report_form_annual_data_report_section_validate(array
}
break;
}
}
else {
} else {
$value = isset($form_value[0]['value']) ?: 0;
$element = $form[$key];
$element_title = isset($element['widget'][0]['#title']) ?: NULL;
$error_msg = t(
"Invalid input for :element_title:, please use number greater or equal to zero.",
[':element_title:' => $element_title]
);
);
_foia_annual_data_report_text_as_integer_validation($form_state, $key, $value, $error_msg);
}
}
Expand Down Expand Up @@ -374,8 +370,7 @@ function foia_annual_data_report_form_annual_data_report_validate(array &$form,
// Check for an existing report.
if ($form_state->getFormObject() instanceof EntityForm) {
$current_nid = $form_state->getformObject()->getEntity()->id();
}
else {
} else {
$current_nid = 0;
}

Expand Down Expand Up @@ -492,8 +487,7 @@ function foia_annual_data_report_unrequire_hidden_fields(array &$form) {
function foia_annual_data_report_set_memory_limit() {
try {
$config_value = foia_annual_data_report_get_config('annual_report_memory_limit');
}
catch (\InvalidArgumentException $e) {
} catch (\InvalidArgumentException $e) {
\Drupal::logger('foia_annual_data_report')->error('Invalid setting requested.');
}

Expand All @@ -508,8 +502,7 @@ function foia_annual_data_report_set_memory_limit() {
function foia_annual_data_report_set_max_execution_time() {
try {
$config_value = foia_annual_data_report_get_config('annual_report_max_execution_time');
}
catch (\InvalidArgumentException $e) {
} catch (\InvalidArgumentException $e) {
\Drupal::logger('foia_annual_data_report')->error('Invalid setting requested.');
}

Expand Down Expand Up @@ -678,3 +671,4 @@ function foia_annual_data_report_entity_operation_alter(array &$operations, Enti
}
}
}

Loading

0 comments on commit c3065cd

Please sign in to comment.