Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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
Comment | File | Size | Author |
---|---|---|---|
#5 | user-1857324-5.patch | 7.7 KB | tim.plunkett |
#5 | interdiff.txt | 1.22 KB | tim.plunkett |
#2 | user-profile-1857324-1.patch | 6.86 KB | Berdir |
Comments
Comment #1
BerdirComment #2
BerdirFirst 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.
Comment #3
moshe weitzman CreditAttribution: moshe weitzman commentedNice. We're finally back to using generic render controller. Wait for green before commit
Comment #4
tim.plunkettComment #5
tim.plunkettActually, we should do this.
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commentedEven better. Wait for green before commit
Comment #7
BerdirHah 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 :)
Comment #8
webchickHm. 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?
Comment #9
BerdirThere'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...
Comment #10
BerdirThere'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...
Comment #11
moshe weitzman CreditAttribution: moshe weitzman commentedBerdir 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.
Comment #12
catchYeah 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.
Comment #13.0
(not verified) CreditAttribution: commentedUpdated issue summary.