-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RM- Debugging Missing CSS #1419
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use ??
@@ -431,143 +431,86 @@ function hedley_admin_administrators_access() { | |||
* This function generates a table displaying the resilience survey results. | |||
*/ | |||
function hedley_admin_resilience_survey_results_table(array $form, array &$form_state) { | |||
$header = array( | |||
drupal_add_css('.align-center { text-align: center; }', ['type' => 'inline']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to end of funciton
|
||
$survey_answers = explode('|', $survey_answers_raw); | ||
$answers_processed = []; | ||
if (empty($result['node'])) return []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are {}
?
if (count($parts) === 2) { | ||
list($question, $answer) = $parts; | ||
$question_number = str_replace('q', '', $question); | ||
foreach (node_load_multiple(array_keys($result['node'])) as $node) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not best styling. Hard to read. First load nodes, then run loop.
$question_number = str_replace('q', '', $question); | ||
foreach (node_load_multiple(array_keys($result['node'])) as $node) { | ||
$nurse_id = field_get_items('node', $node, 'field_nurse')[0]['target_id'] ?? NULL; | ||
$nurse_name = $nurse_id ? (node_load($nurse_id)->title ?? 'Unknown Nurse') : 'Unknown Nurse'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, too much in one row. Separate for better readability.
Also ??
is php 8 operator. We're using php 7. Can't use it.
$nurse_node = node_load($nurse_id); | ||
if ($nurse_node) { | ||
$health_center_id = field_get_items('node', $nurse_node, 'field_health_centers')[0]['target_id'] ?? NULL; | ||
$health_center_name = $health_center_id ? (node_load($health_center_id)->title ?? 'Unknown Center') : 'Unknown Center'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, too much in one row. Separate for better readability.
Also ?? is php 8 operator. We're using php 7. Can't use it.
|
||
if ($question_number >= 1 && $question_number <= 12) { | ||
$answers_processed["question_$question_number"] = $answer; | ||
$survey_type = field_get_items('node', $node, 'field_resilience_survey_type')[0]['value'] ?? 'Unknown'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use ??
if ($question_number >= 1 && $question_number <= 12) { | ||
$answers_processed["question_$question_number"] = $answer; | ||
$survey_type = field_get_items('node', $node, 'field_resilience_survey_type')[0]['value'] ?? 'Unknown'; | ||
$date_measured = field_get_items('node', $node, 'field_date_measured')[0]['value'] ?? 'Unknown'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use ??
} | ||
|
||
$form_state['rows'] = $rows; | ||
$form['csv_export_button'] = ['#type' => 'submit', '#value' => t('Export to CSV'), '#submit' => ['hedley_admin_resilience_survey_export_csv']]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't be single line. Revert.
} | ||
|
||
$form_state['rows'] = $rows; | ||
$form['csv_export_button'] = ['#type' => 'submit', '#value' => t('Export to CSV'), '#submit' => ['hedley_admin_resilience_survey_export_csv']]; | ||
$form['table'] = ['#theme' => 'table', '#header' => $header, '#rows' => $rows, '#empty' => t('No survey results available')]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't be single line. Revert.
Coder failure: |
#1400