user.html.twig

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 also

template_preprocess()

template_preprocess_user()

File

drupal/core/modules/user/templates/user.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to present all user data.
  5. *
  6. * This template is used when viewing a registered user's page,
  7. * e.g., example.com/user/123. 123 being the user's ID.
  8. *
  9. * Available variables:
  10. * - content: A list of content items. Use 'content' to print all content, or
  11. * print a subset such as 'content.field_example'.
  12. * - Field variables: For each field instance attached to the user a
  13. * corresponding variable is defined; e.g., account.field_example has a
  14. * variable 'field_example' defined. When needing to access a field's raw
  15. * values, developers/themers are strongly encouraged to use these
  16. * variables. Otherwise they will have to explicitly specify the desired
  17. * field language, e.g. account.field_example.en, thus overriding any
  18. * language negotiation rule that was previously applied.
  19. * - attributes: HTML attributes for the container element.
  20. *
  21. * @see template_preprocess()
  22. * @see template_preprocess_user()
  23. *
  24. * @ingroup themeable
  25. */
  26. #}
  27. <article{{ attributes }}>
  28. {% if content %}
  29. {{- content -}}
  30. {% endif %}
  31. </article>

Related topics