Part of #2006152: [meta] Don't call theme() directly anywhere outside drupal_render().

to test this code

  1. Visit Reports > Recent Log Messages
  2. Review the contents of the "Messages" column
  3. Click on the link in the message column, to see the full message
  4. Review the contents of the row labeled "Message"
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thedavidmeister’s picture

Issue tags: +Novice
InternetDevels’s picture

Assigned: Unassigned » InternetDevels

We are working today with this issue during Code Sprint UA.

InternetDevels’s picture

Assigned: InternetDevels » Unassigned
Status: Active » Needs review
Issue tags: +CodeSprintUA
FileSize
1.76 KB

Patch attached.

podarok’s picture

Status: Needs review » Reviewed & tested by the community

#3 nice
RTBC

catch’s picture

Status: Reviewed & tested by the community » Needs review

Shouldn't these be format_username()?

siccababes’s picture

Status: Needs review » Reviewed & tested by the community

If we still want the linking functionality, I think it needs to be called from theme_username() instead of calling user_format_name() here, right? Let's leave this as-is and fix that if this is an issue. Follow up: #2019305: Call user_format_name from theme_username

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.phpundefined
@@ -169,7 +173,7 @@ public function overview() {
-          theme('username', array('account' => $dblog)),
+          drupal_render($username),

I don't think we need to use drupal_render here...
just replacing this with...

array(
  '#theme'=>'username',
  '#account'=> $dblog,
)

Should work...

giammi’s picture

Giving it a shot.

Status: Needs review » Needs work

The last submitted patch, dblog-replace_theme_with_drupal_render_in_dblog-2008990-8.patch, failed testing.

giammi’s picture

Assigned: giammi » Unassigned

Error Message I received was:
HTTP response expected 200, actual 500 Browser DbLogTest.php 256

Checked the DbLogTest.php which gave
// View the database log report.
$this->drupalGet('admin/reports/dblog');

running /admin/reports/dblog gave me message
Fatal error: Call to undefined method stdClass::printed() in /home/giammi/coding/drupal/core/lib/Drupal/Core/Template/Attribute.php on line 105

Hope somebody else can take over.

heddn’s picture

Status: Needs work » Needs review
FileSize
576 bytes
2.29 KB

Let's give this a try.

nesta_’s picture

nesta_’s picture

Status: Needs review » Reviewed & tested by the community

Applied the patch and everything running smoothly. Revised code and I like it.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Just a minor code style nit... otherwise looks great.

+++ b/core/modules/dblog/dblog.admin.incundefined
@@ -97,6 +97,10 @@ function dblog_event($id) {
+    $username = array(
+      '#theme'=>'username',
+      '#account'=> $dblog,
+    );

+++ b/core/modules/dblog/lib/Drupal/dblog/Controller/DbLogController.phpundefined
@@ -162,6 +162,10 @@ public function overview() {
+      $username = array(
+        '#theme'=>'username',
+        '#account'=> $dblog,
+      );

Missing some spaces... should be like this

    $username = array(
      '#theme' => 'username',
      '#account' => $dblog,
    );
heddn’s picture

I missed that in the re-roll. Let's see how this flies.

pwieck’s picture

Status: Needs work » Needs review

@heddn changing status 'needs review', so test will run.

siccababes’s picture

Status: Needs review » Reviewed & tested by the community

I followed the instructions to test this code. I went to the list under recent log messages under reports, and I saw the messages. When I clicked on the message, I saw the same warnings. This code seems to work just fine.

alexpott’s picture

Committed d97d1aa and pushed to 8.x. Thanks!

jlbellido’s picture

Status: Reviewed & tested by the community » Fixed

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

Anonymous’s picture

Issue summary: View changes

add how to test