Follow-up of #1026616: Implement an entity render controller.

All that UserRenderController currently does is this:

    // @todo rename "theme_user_profile" to "theme_user", 'account' to 'user'.
    $return['#theme'] = 'user_profile';
    $return['#account'] = $return['#user'];

As suggested in the @todo, let's rename the default theme function (template?) and #account to #user then we can use the default implementation of the render controller for users.

Corresponding issue for taxonomy terms: #1857336: Use entity variable in $build for taxonomy_term entity

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Component: comment.module » user.module
Issue tags: +entity
Berdir’s picture

Status: Active » Needs review
Issue tags: -entity +Entity system
FileSize
6.86 KB

First patch.

IMHO, user_view() user(-profile).tpl.php and template_preprocess_user(_profile) have a lot of duplicated, unecessary information that doesn't belong in there, like how to use a template file, how to work with fields, that it's used for user/uid, lots of mentions of profile (and categories) which doesn't make much sense anymore now that profile.module is removed. And if profile2.module will be added, then that will mean completely different templates anyway. Another topic is the mix of account and user, not sure what to do about.

moshe weitzman’s picture

Status: Needs review » Fixed

Nice. We're finally back to using generic render controller. Wait for green before commit

tim.plunkett’s picture

Status: Fixed » Reviewed & tested by the community
tim.plunkett’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.22 KB
7.7 KB

Actually, we should do this.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Even better. Wait for green before commit

Berdir’s picture

Hah you're fast ;)

I actually left the render controller because I wanted to move http://api.drupal.org/api/drupal/core%21modules%21user%21user.module/fun... into it and then kinda forgot and wasn't sure if we should do this in the same issue :)

webchick’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs themer review

Hm. We seem to have removed some context from the theme function/template name? You're theming a user profile here, not a user. A user can show up in many different ways: the author of a node, a sidebar block, etc. Seems best to be explicit. Am I missing something?

Berdir’s picture

There's no such thing as a user profile anymore IMHO. user is an entity and we do an entity_view($user) to view it. Why should that use node.tpl.php for nodes but user-profile.tpl.php for users?

node and comment author (picture) now also use user_view() and also use user-profile.tpl.php. And if profile2.module makes it into core, we have user-profile.tpl.php and profile.tpl.php...

Berdir’s picture

There's no such thing as a user profile anymore IMHO. user is an entity and we do an entity_view($user) to view it. Why should that use node.tpl.php for nodes but user-profile.tpl.php for users?

node and comment author (picture) now also use user_view() and also use user-profile.tpl.php. And if profile2.module makes it into core, we have user-profile.tpl.php and profile.tpl.php...

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs themer review

Berdir has it right. Just to elaborate, we have view modes now so themeing a user in a sidebar can be user_view($account, 'narrow') or whatever.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Yeah I think this is fine and berdir's answer makes sense. If anything we'd use account here but the entity isn't called account so best to just keep it consistent. Committed/pushed to 8.x.

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

Anonymous’s picture

Issue summary: View changes

Updated issue summary.