Comments

pplantinga’s picture

Status: Active » Needs review
StatusFileSize
new10.94 KB

Here's a patch

plopesc’s picture

Status: Needs review » Needs work

Hello.

It looks good to me. Maybe you could add a minor improvement.

+++ b/core/modules/update/update.report.incundefined
@@ -40,33 +44,51 @@ function theme_update_report($variables) {
+        $image['#uri'] = 'core/misc/watchdog-error.png';
+        $image['#alt'] = t('error');
+        $image['#title'] = t('error');

You could save some lines and avoid misspellings assigning values for '#alt' and '#title' in the same line $image['#alt'] = $image['#title'] = t('error');.

Regards.

cconrad’s picture

Assigned: Unassigned » cconrad

Trying to patch the patch (core office hours - nick cconrad - assigned by heddn)

pplantinga’s picture

Assigned: cconrad » Unassigned
Status: Needs work » Needs review

I have to say I disagree. For one, I don't think of "saving lines" as a worthwhile goal, since whitespace generally helps readability, and two, i think

$image['#alt'] = $image['#title'] = t('error');

is less clear (less readable) than

$image['#alt'] = t('error');
$image['#title'] = t('error');

Also, maybe someday we'll want to have different values or remove one of these. This makes it easier to change and makes the patch more readable too.

cconrad’s picture

Implemented the improvement suggested by plopesc in #2

cconrad’s picture

I patched this because I got it in Drupal Office Hours, but I tend to agree with pplantinga, the original patch is more readable.

cconrad’s picture

How about this compromise - avoids misspellings, only one call to t(), and better readability?

$t_error = t('error');
$image['#alt'] = $t_error;
$image['#title'] = $t_error;
pplantinga’s picture

Status: Needs review » Needs work

Looks like you tried to edit the patch directly? Trying to apply the patch in #7 gave: fatal: corrupt patch at line 128

Git tends to not like it when you edit a patch, so it's better to apply the patch, make the changes, and generate a new patch.

I could live with the changes suggested in #7, when there's a valid patch.

cconrad’s picture

Right. I'll get back to this with a fixed patch.

plopesc’s picture

Status: Needs work » Needs review

Hello

@pplantinga:
I understand your point. It was a suggestion, that you can take or not. Maybe other more experienced contributors could give their opinion in order to follow one approach or the other.

@cconrad:
Thanks for your approach, It's a different point and it will be take into account.

Different points of view are good and that's the way to improve the Drupal code, everyone can say and then, decide the best option.

Regards

cconrad’s picture

In case you decide to use the "compromise" from #7, here's a fixed patch that hopefully passes.

plopesc’s picture

Hi,

Here are my two cents about this issue. This patch moves the $image array definition below the switch call. Then, the whole renderable array is built in a single step, and its properties are declared in that switch depending on the project status.

What do you think about it?

Regards.

plopesc’s picture

Sorry, my previous interdiff was bad named.

Attaching with correct name.

pplantinga’s picture

Looks good to me. Let's see if testbot likes it.

pplantinga’s picture

Status: Needs review » Reviewed & tested by the community

Looks like testbot likes it too.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/update/update.report.incundefined
@@ -43,30 +47,48 @@ function theme_update_report($variables) {
+        $icon = drupal_render($image);
...
+        $icon = drupal_render($image);
...
+        $icon = drupal_render($image);
...
+        $icon = drupal_render($image);
...
+    $image = array(
+      '#theme' => 'image',
+      '#width' => 18,
+      '#height' => 18,
+      '#uri' => $uri,
+      '#alt' => $text,
+      '#title' => $text,
+    );

This seems to be occurring in the wrong place. the first time around $image is not going to exist...

+++ b/core/modules/update/update.report.incundefined
@@ -43,30 +47,48 @@ function theme_update_report($variables) {
     $row .= '<span class="icon">' . $icon . '</span>';

Just do this instead

  $row .= '<span class="icon">' . drupal_render($image) . '</span>';
plopesc’s picture

Status: Needs work » Needs review
StatusFileSize
new1.86 KB
new10.69 KB

D'oh!

It was fast patch without the necessary review from my side.

Re-rolled.

Thanks for your hard work @alexpott

jenlampton’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the quick update @plopesc

catch’s picture

+++ b/core/modules/update/update.manager.incundefined
@@ -257,8 +257,13 @@ function update_manager_update_form($form, $form_state = array(), $context) {
     $form['manual_updates'] = array(
-      '#markup' => theme('table', array('header' => $headers, 'rows' => $projects['manual'])),

Is it really necessary to use #markup, why not have the table as a child and let it get rendered later?

plopesc’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new843 bytes
new10.58 KB

@catch, you're right, It's not necessary ;)

Re-rolling using '#type' => 'table' instead of '#markup' => drupal_render()

Thanks

thedavidmeister’s picture

Status: Needs review » Needs work

Why is one of the tables using #theme and another using #type?

Both should probably use #type, as per #1876712: [meta] Convert all tables in core to new #type 'table'.

Also, as I understand from reading over that issue, #type 'table' expects rows to be provided as child elements rather than in #rows.

thedavidmeister’s picture

Actually, the patches would be easier to review if we kept the tables as #theme 'table' for now, and let the other meta issue handle converting from #theme to #type - that's how other patches on sibling issues to this issue have handled tables.

pplantinga’s picture

Status: Needs work » Needs review
StatusFileSize
new816 bytes
new10.58 KB

How about this?

thedavidmeister’s picture

Status: Needs review » Reviewed & tested by the community

seems fair.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 53731f9 and pushed to 8.x. Thanks!

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