diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index a2f74a3..8bd0be3 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -675,29 +675,22 @@ function rdf_preprocess_username(&$variables) { $variables['attributes']['about'] = url('user/' . $variables['uid']); } - $attributes = array(); // The typeof attribute specifies the RDF type(s) of this resource. They // are defined in the 'rdftype' property of the user RDF mapping. if (!empty($rdf_mapping['rdftype'])) { - $attributes['typeof'] = $rdf_mapping['rdftype']; + $variables['attributes']['typeof'] = $rdf_mapping['rdftype']; } // Annotate the username in RDFa. A property attribute is used with an empty // datatype attribute to ensure the username is parsed as a plain literal // in RDFa 1.0 and 1.1. if (!empty($rdf_mapping['name'])) { - $attributes['property'] = $rdf_mapping['name']['predicates']; - $attributes['datatype'] = ''; + $variables['attributes']['property'] = $rdf_mapping['name']['predicates']; + $variables['attributes']['datatype'] = ''; } // Add the homepage RDFa markup if present. if (!empty($variables['homepage']) && !empty($rdf_mapping['homepage'])) { - $attributes['rel'] = $rdf_mapping['homepage']['predicates']; - } - // The remaining attributes can have multiple values listed, with whitespace - // separating the values in the RDFa attributes - // (see http://www.w3.org/TR/rdfa-syntax/#rdfa-attributes). - // Therefore, merge rather than override so as not to clobber values set by - // earlier preprocess functions. - $variables['attributes'] = NestedArray::mergeDeep($variables['attributes'], $attributes); + $variables['attributes']['rel'] = $rdf_mapping['homepage']['predicates']; + } } /** 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 ee82187..0000000 --- a/core/modules/user/templates/user-picture.tpl.php +++ /dev/null @@ -1,23 +0,0 @@ - - -
- -
- diff --git a/core/modules/user/templates/user.html.twig b/core/modules/user/templates/user.html.twig new file mode 100644 index 0000000..c89ecb4 --- /dev/null +++ b/core/modules/user/templates/user.html.twig @@ -0,0 +1,30 @@ +{# +/** + * @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. + * + * @see template_preprocess() + * @see template_preprocess_user() + * + * @ingroup themeable + */ +#} + + {% if content is not empty %} + {{- content -}} + {% endif %} + diff --git a/core/modules/user/templates/user.tpl.php b/core/modules/user/templates/user.tpl.php deleted file mode 100644 index 617d310..0000000 --- a/core/modules/user/templates/user.tpl.php +++ /dev/null @@ -1,32 +0,0 @@ -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 - */ -?> -
> - -
diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 5afcfd9..a8de3a8 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 5f0cfab..84a4d6e 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -5,6 +5,7 @@ * User page callback file for the user module. */ +use Drupal\Core\Template\Attribute; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -179,12 +180,14 @@ 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 to check access for + * (Drupal\user\Plugin\Core\Entity\User). */ function template_preprocess_user(&$variables) { $account = $variables['elements']['#user']; @@ -196,6 +199,9 @@ function template_preprocess_user(&$variables) { // Preprocess fields. field_attach_preprocess($account, $variables['elements'], $variables); + + // Set up attributes. + $variables['attributes'] = new Attribute(array('class' => array('profile'))); } /**