I looked into converting this theme function however it returns an array, not HTML. Just wondering if we should eliminate this from the list.

@see template_preprocess_item_list()
@see _template_preprocess_item_list()
@see _template_preprocess_item_list_attributes()
function theme_authorize_message($variables) {
  $message = $variables['message'];
  $success = $variables['success'];
  if ($success) {
    $item = array('data' => $message, 'class' => array('success'));
  }
  else {
    $item = array('data' => '<strong>' . $message . '</strong>', 'class' => array('failure'));
  }
  return $item;
}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vlad.dancer’s picture

I think it's used like hook, you can alter this theme and add your own variables or modify them. If we replace this theme by just simple func other modules couldn't modify items! What do you think?

vlad.dancer’s picture

Status: Needs review » Active

Better status

EVIIILJ’s picture

Well, I looked into the list_items preprocess/theme_ function and it exepts a string or array so I guess we could just pass in the HTML as the item (see template file included within this patch)

EVIIILJ’s picture

Status: Active » Needs review

forgot the status change :(

steveoliver’s picture

Status: Needs review » Needs work

Nice work, EVIIILJ.

+++ b/core/includes/theme.maintenance.inc
@@ -274,3 +274,10 @@ function theme_authorize_message($variables) {
+
+/**
+ * Preprocess variables for a single log message from the authorize.php batch operation.
+ */
+function template_preprocess_authorize_message(&$variables) {
+  // simply pass through variables to authorize-message template file.
+}

I'm pretty sure we can leave this preprocess out.

+++ b/core/themes/stark/templates/theme.maintenance.inc/authorize-message.html.twig
@@ -0,0 +1,20 @@
+ * @file
+ * Default theme implementation for
+ *

Default theme implementation for a single log message from the authorize.php batch operation.

+++ b/core/themes/stark/templates/theme.maintenance.inc/authorize-message.html.twig
@@ -0,0 +1,20 @@
+ * Available variables:
+ * message: The log message.
+ * success: A boolean indicating failure or success.

Needs indentation.

+++ b/core/themes/stark/templates/theme.maintenance.inc/authorize-message.html.twig
@@ -0,0 +1,20 @@
+ * @see template_preprocess_authorize_message

And we can also remove this, of course.

EVIIILJ’s picture

Status: Needs work » Needs review
FileSize
789 bytes

Awesome feedback steveoliver! Thank you.

steveoliver’s picture

Status: Needs review » Postponed

This looks good, but I can't get to the screen at the end of update.php where I'd see the report messages. It gets stuck at Review updates (Step 3).

Postponed until we can get to the end of update.php.

jenlampton’s picture

Component: Twig templates » Twig templates conversion (front-end branch)
Status: Postponed » Active

un-postponing since I need this one back now :) I opened a core issue for the current bug: #1885788: An AJAX HTTP error occurred during module installation via UI

but it turns out that even when AJAX crashes, you can get to the reports page by clicking on the link at the top of the page with the ugly message, so moving foward on this again.

jenlampton’s picture

Status: Active » Fixed

Alrighty, I had to use the trick mentioned by @artofeclipse in #1820052: Converting theme_update_page to get the preprocess function to fire for authorize_report, but by the time I got the report working the messages were perfectly fine :)

Thank you all for working on this :)
Committed and pushed to front-end.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

added ref to template preprocess functions