Commit dcfd4deb authored by alexpott's avatar alexpott

Issue #1898468 by Cottser, joelpittet, rteijeiro, c4rl, steveoliver, scor,...

Issue #1898468 by Cottser, joelpittet, rteijeiro, c4rl, steveoliver, scor, jenlampton, idflood, shanethehat, thedavidmeister: [READY] user.module - Convert PHPTemplate templates to Twig.
parent f2aa485d
<?php
/**
* @file
* Default theme implementation to present a picture configured for the
* user's account.
*
* Available variables:
* - $user_picture: Image set by the user or the site's default. Will be linked
* depending on the viewer's permission to view the user's profile page.
* - $account: Array of account information. Potentially unsafe. Be sure to
* check_plain() before use.
*
* @see template_preprocess_user_picture()
*
* @ingroup themeable
*/
?>
<?php if ($user_picture): ?>
<div class="user-picture">
<?php print $user_picture; ?>
</div>
<?php endif; ?>
{#
/**
* @file
* Default theme implementation to present all user data.
*
* This template is used when viewing a registered user's page,
* e.g., example.com/user/123. 123 being the user's ID.
*
* Available variables:
* - content: A list of content items. Use 'content' to print all content, or
* print a subset such as 'content.field_example'.
* - Field variables: For each field instance attached to the user a
* corresponding variable is defined; e.g., account.field_example has a
* variable 'field_example' defined. When needing to access a field's raw
* values, developers/themers are strongly encouraged to use these
* variables. Otherwise they will have to explicitly specify the desired
* field language, e.g. account.field_example.en, thus overriding any
* language negotiation rule that was previously applied.
* - attributes: HTML attributes for the container element.
*
* @see template_preprocess()
* @see template_preprocess_user()
*
* @ingroup themeable
*/
#}
<article{{ attributes }}>
{% if content %}
{{- content -}}
{% endif %}
</article>
<?php
/**
* @file
* Default theme implementation to present all user data.
*
* This template is used when viewing a registered user's page,
* e.g., example.com/user/123. 123 being the users ID.
*
* Use render($content) to print all content, or print a subset
* such as render($content['field_example']).
* By default, $user_profile['summary'] is provided, which contains data on the
* user's history. Other data can be included by modules.
*
* Available variables:
* - $content: An array of content items. Use render() to print them.
* - Field variables: for each field instance attached to the user a
* corresponding variable is defined; e.g., $account->field_example has a
* variable $field_example defined. When needing to access a field's raw
* values, developers/themers are strongly encouraged to use these
* variables. Otherwise they will have to explicitly specify the desired
* field language, e.g. $account->field_example['en'], thus overriding any
* language negotiation rule that was previously applied.
*
* @see template_preprocess_user()
*
* @ingroup themeable
*/
?>
<article class="profile"<?php print $attributes; ?>>
<?php print render($content); ?>
</article>
...@@ -93,8 +93,8 @@ function user_theme() { ...@@ -93,8 +93,8 @@ function user_theme() {
return array( return array(
'user' => array( 'user' => array(
'render element' => 'elements', 'render element' => 'elements',
'template' => 'user',
'file' => 'user.pages.inc', 'file' => 'user.pages.inc',
'template' => 'user',
), ),
'user_admin_permissions' => array( 'user_admin_permissions' => array(
'render element' => 'form', 'render element' => 'form',
......
...@@ -179,12 +179,13 @@ function user_logout() { ...@@ -179,12 +179,13 @@ function user_logout() {
} }
/** /**
* Process variables for user.tpl.php. * Prepares variables for user templates.
* *
* The $variables array contains the following arguments: * Default template: user.html.twig.
* - $account
* *
* @see user.tpl.php * @param array $variables
* An associative array containing:
* - account: The user account.
*/ */
function template_preprocess_user(&$variables) { function template_preprocess_user(&$variables) {
$account = $variables['elements']['#user']; $account = $variables['elements']['#user'];
...@@ -196,6 +197,9 @@ function template_preprocess_user(&$variables) { ...@@ -196,6 +197,9 @@ function template_preprocess_user(&$variables) {
// Preprocess fields. // Preprocess fields.
field_attach_preprocess($account, $variables['elements'], $variables); field_attach_preprocess($account, $variables['elements'], $variables);
// Set up attributes.
$variables['attributes']['class'][] = 'profile';
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment