diff --git a/core/modules/user/templates/user-picture.tpl.php b/core/modules/user/templates/user-picture.tpl.php deleted file mode 100644 index ee821878602f0664e4a2afe45ead665cc5c82af2..0000000000000000000000000000000000000000 --- a/core/modules/user/templates/user-picture.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ -<?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; ?> diff --git a/core/modules/user/templates/user.html.twig b/core/modules/user/templates/user.html.twig new file mode 100644 index 0000000000000000000000000000000000000000..e011796d24bdafb46c133831bde5feffa91dba7e --- /dev/null +++ b/core/modules/user/templates/user.html.twig @@ -0,0 +1,31 @@ +{# +/** + * @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> diff --git a/core/modules/user/templates/user.tpl.php b/core/modules/user/templates/user.tpl.php deleted file mode 100644 index 617d31077a75f28e9902353e5303905fa3d24955..0000000000000000000000000000000000000000 --- a/core/modules/user/templates/user.tpl.php +++ /dev/null @@ -1,32 +0,0 @@ -<?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> diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 42a79dbc5dda68d6c7c04de6e7c59cb047abff3b..d02a91ae82e365b5cf3687b8dd120f8e31cb6159 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -93,8 +93,8 @@ function user_theme() { return array( 'user' => array( 'render element' => 'elements', - 'template' => 'user', 'file' => 'user.pages.inc', + 'template' => 'user', ), 'user_admin_permissions' => array( 'render element' => 'form', diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc index 5f0cfabffbea52c760c84c76797f1384c69889db..5817d9c39290373b1d34057f648b8911fa91f4b7 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -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: - * - $account + * Default template: user.html.twig. * - * @see user.tpl.php + * @param array $variables + * An associative array containing: + * - account: The user account. */ function template_preprocess_user(&$variables) { $account = $variables['elements']['#user']; @@ -196,6 +197,9 @@ function template_preprocess_user(&$variables) { // Preprocess fields. field_attach_preprocess($account, $variables['elements'], $variables); + + // Set up attributes. + $variables['attributes']['class'][] = 'profile'; } /**