diff --git a/core/modules/user/templates/user-signature.html.twig b/core/modules/user/templates/user-signature.html.twig index cac3a68..2e8bc0a 100644 --- a/core/modules/user/templates/user-signature.html.twig +++ b/core/modules/user/templates/user-signature.html.twig @@ -17,6 +17,6 @@ #} {% spaceless %} {% if signature %} -
{{ signature }} +
{{ signature }}
{% endif %} {% endspaceless %} diff --git a/core/modules/user/templates/user.html.twig b/core/modules/user/templates/user.html.twig index c7a9a0e..46e6ce9 100644 --- a/core/modules/user/templates/user.html.twig +++ b/core/modules/user/templates/user.html.twig @@ -4,22 +4,20 @@ * 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. + * e.g., example.com/user/123. 123 being the user's ID. * - * Use 'content' to print all content, or print a subset - * such as '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. + * Use 'content' to print all content, or print a subset such as + * 'content.field_example'. * * Available variables: * - content: A list of content items. * - 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. + * 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() * @see template_preprocess_user() diff --git a/core/modules/user/templates/username.html.twig b/core/modules/user/templates/username.html.twig index 4524dba..5317014 100644 --- a/core/modules/user/templates/username.html.twig +++ b/core/modules/user/templates/username.html.twig @@ -7,7 +7,7 @@ * - account: The user object to format. * - name: The user's name, sanitized. * - extra: Additional text to append to the user's name, sanitized. - * - link: The fully generated link by l if a link_path is set + * - link: The link fully generated by l() if link_path is set. * - link_path: The path or URL of the user's profile page, home page, * or other desired page to link to for more information about the user. * - link_options: An array of options to pass to the l() function's $options diff --git a/core/modules/user/user.admin.inc b/core/modules/user/user.admin.inc index aee6ea1..9482f59 100644 --- a/core/modules/user/user.admin.inc +++ b/core/modules/user/user.admin.inc @@ -818,7 +818,7 @@ function theme_user_admin_permissions($variables) { } /** - * Default theme implementation for an individual permission description. + * Prepares variables for individual permission description templates. * * Default template: user-permission-description.html.twig. * diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 3445c10..a5dbdd8 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -731,7 +731,7 @@ function user_template_preprocess_default_variables_alter(&$variables) { } /** - * Preprocesses variables for username. + * Prepares variables for username templates. * * Default template: username.html.twig. * @@ -741,7 +741,7 @@ function user_template_preprocess_default_variables_alter(&$variables) { * (Drupal\user\Plugin\Core\Entity\User). * - uid: The user uid number. * - * Modules that make any changes to variables like 'name' or 'extra' must insure + * Modules that make any changes to variables like 'name' or 'extra' must ensure * that the final string is safe to include directly in the output by using * check_plain() or filter_xss(). */ @@ -789,7 +789,17 @@ function template_preprocess_username(&$variables) { $variables['link_options']['html'] = TRUE; // Set a default class. $variables['attributes'] = new Attribute(array('class' => array('username'))); +} +/** + * Processes variables for theme_username(). + * + * @see template_preprocess_username() + */ +function template_process_username(&$variables) { + // Finalize the link_options array for passing to the l() function. + // This is done in the process phase so that attributes may be added by + // modules or the theme during the preprocess phase. if (isset($variables['link_path'])) { // $variables['attributes'] contains attributes that should be applied // regardless of whether a link is being rendered or not. @@ -2266,19 +2276,6 @@ function user_build_filter_query(SelectInterface $query) { } /** - * Preprocess variables for user signature templates. - * - * Default template: user-signature.html.twig. - * - * @param array $variables - * An associative array containing: - * - signature: The user's signature. - */ -function template_preprocess_user_signature(&$variables) { - $variables['attributes'] = new Attribute(array('class' => array('clear'))); -} - -/** * Get the language object preferred by the user. This user preference can * be set on the user account editing page, and is only available if there * are more than one languages enabled on the site. If the user did not diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc index 590d65a..1d6856d 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -176,7 +176,7 @@ function user_logout() { } /** - * Prepares variables for user template. + * Prepares variables for user templates. * * Default template: user.html.twig. * @@ -197,8 +197,7 @@ function template_preprocess_user(&$variables) { field_attach_preprocess($account, $variables['elements'], $variables); // Set up attributes. - $variables['attributes'] = array('class' => array('profile')); - $variables['attributes'] = new Attribute($variables['attributes']); + $variables['attributes'] = new Attribute(array('class' => array('profile'))); } /**