From f4df88360d7196840f02d10bc2c074dc33ffe47a Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Thu, 25 May 2017 13:51:16 -0300 Subject: [PATCH] output on redirect page is now a render array --- includes/form.inc | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/includes/form.inc b/includes/form.inc index 86772e7..06878b5 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -108,18 +108,42 @@ function upei_roblib_ill_form_submit($form, &$form_state) { * a string of HTML to display including the results of the ILL request and some boilerplate text. */ function upei_roblib_ill_form_redirect() { - //TODO turn this into a drupal render array //TODO phone number, email etc. could be variables read from the database. - if (isset($_GET['error']) && $_GET['error'] === 'TRUE') { - $std_message = "
To contact the department about this request, you can send a message to ill@upei.ca or -call 902-566-0445
"; + $librarian_link = l(t('subject-specific'), 'http://library.upei.ca/librarians', array('html' => TRUE)); + $help_message = t("We can help! Please contact your !librarian_link librarian if you'd like help finding more resources relating to your topic.", + array('!librarian_link' => $librarian_link)); + $standard_message = t("To contact the department about this request, you can send a message to ill@upei.ca or +call 902-566-0445."); + if (isset($_GET['error']) && $_GET['error'] === 'FALSE') { + $standard_message = t("A message including the Request ID has been sent to @email.", array( + '@email' => $_GET['email'], + )) . $standard_message; } - else { - $std_message = "
A message including the Request ID has been sent to " . $_GET['email'] . ".
To contact the department about this request, you can send a message to ill@upei.ca or -call 902-566-0445
-
We can help! Please contact your subject-specific librarian if you'd like help finding more resources relating to your topic.
"; - } - return "
" . $_GET['message'] . '
' . $std_message; + + $output = array( + '#prefix' => '
', + '#suffix' => '
', + 'dynamic_message' => array( + '#type' => 'markup', + '#markup' => $_GET['message'], + '#prefix' => '
', + '#suffix' => '
', + ), + 'standard_message' => array( + '#type' => 'markup', + '#markup' => $standard_message, + '#prefix' => '
', + '#suffix' => '
', + ), + 'help_message' => array( + '#type' => 'markup', + '#markup' => $help_message, + '#allowed_tags' => ['a', 'source'], + '#prefix' => '
', + '#suffix' => '
', + ), + ); + return drupal_render($output); }