Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost’s picture

Can you pot a patch and we'll see how many tests are broken first.
// code wins

somepal’s picture

Assigned: Unassigned » somepal
somepal’s picture

I am working on this. screenshot of errors displayed after these modifications attached along with the patch.

somepal’s picture

somepal’s picture

Status: Needs work » Needs review
FileSize
1.83 KB
1.83 KB

So here's the patch.

andypost’s picture

Status: Needs review » Needs work
+++ b/core/modules/system/system.admin.incundefined
@@ -1304,7 +1304,12 @@ function system_status($check = FALSE) {
-  return theme('status_report', array('requirements' => $requirements));
+  $status_report = array('#theme' => 'status_report');

should return render array

return array(
  '#theme' => 'status_report',
  'requirements' => $requirements,
);
+++ b/core/modules/system/system.admin.incundefined
@@ -1556,14 +1561,16 @@ function theme_status_report($variables) {
-      $output .= '<tr class="' . $severity['class'] . '">';
...
+      if(!empty($requirement['title'])) {
+        $output .= '<tr class="' . $severity['class'] . '">';

any reason to check title?
Please try not touch this

andypost’s picture

Status: Needs work » Needs review
FileSize
1.2 KB
andypost’s picture

FileSize
6.01 KB

Suppose better of theme_status_report() at all

andypost’s picture

@Joe9 please re-roll #7

For theme function filed #2013258: Simplify render for theme_status_report()

Status: Needs review » Needs work

The last submitted patch, system_status-8.patch, failed testing.

somepal’s picture

@andypost I would need to target status() instead of system_status() now.

somepal’s picture

@andypost Here's the re-roll for #7.

+++ b/core/modules/system/system.admin.incundefined
@@ -1556,14 +1561,16 @@ function theme_status_report($variables) {
-      $output .= '<tr class="' . $severity['class'] . '">';
...
+      if(!empty($requirement['title'])) {
+        $output .= '<tr class="' . $severity['class'] . '">';

was to avoid blank rows rendered at the bottom (pls ref. attach image)

somepal’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 2010982_replace-theme-system-status_12.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
1.2 KB

Better to make Controller to return render array

tstoeckler’s picture

+++ b/core/modules/system/system.module
@@ -161,7 +161,7 @@ function system_theme() {
+      'variables' => array('requirements' => NULL),

Super minor, but would an empty array make more sense here?

Otherwise makes total sense!

andypost’s picture

@tstoeckler following hook_theme() all core defines default as NULL, so not sure it makes sense to introduce new kind of default value

tstoeckler’s picture

OK, fine with me. Looks RTBC to me, but I'll let someone else pull the trigger. :-)

pplantinga’s picture

Shouldn't we be using drupal_render?

instead of:

-    return theme('status_report', array('requirements' => $requirements));
+    return array('#theme' => 'status_report', '#requirements' => $requirements);

use:

$status_report('#theme' => 'status_report', '#requirements' => $requirements);
return drupal_render($status_report);
pplantinga’s picture

Shouldn't we be using drupal_render?

instead of:

-    return theme('status_report', array('requirements' => $requirements));
+    return array('#theme' => 'status_report', '#requirements' => $requirements);

use:

$status_report('#theme' => 'status_report', '#requirements' => $requirements);
return drupal_render($status_report);
tstoeckler’s picture

@pplantinga: We try to render things as late as possible, because as long as they are not rendered one can alter the render array. As soon as they are rendered you only have a string and there is no way to alter it anymore. So whenever simply passing a render array works, we should do it.

pplantinga’s picture

Fine by me. I understand that it's better, I was just thinking of guidelines on #2006152: [meta] Don't call theme() directly anywhere outside drupal_render() where it says:

Don't try to do anything new/fancy like returning the renderable array instead of rendering it where theme() was, despite this probably being "better" in many cases it will also incur quite a bit of extra testing overhead. We're trying to minimise the scope of this issue. Don't change the name/structure of any existing variables or try to add/remove/merge any existing functions. Touch nothing but the lamp (@see Aladdin). If the patch does change anything else, it will need manual testing and therefore slow/stall what should be relatively simple tasks. @thedavidmeister, who wrote this rule, is aware of the irony/hypocrisy in that the patches he submitted (before writing this rule) all refactored things slightly when they probably shouldn't have :P

tstoeckler’s picture

Ahh, OK. I still think we're fine in this case. Controllers returning render arrays is really standard behavior. Don't feel strongly either way, though.

pplantinga’s picture

Status: Needs review » Postponed

Changing requirements array to a variable is (hopefully) going to happen here:

#2041283: theme_status_report() is severely broken

pplantinga’s picture

Status: Postponed » Needs work
pplantinga’s picture

Updated patch

pplantinga’s picture

Status: Needs work » Needs review
Eric_A’s picture

Status: Needs review » Reviewed & tested by the community

All issues gone and a perfect one-liner remained.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

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

Anonymous’s picture

Issue summary: View changes

Updated issue summary.