You are here

submitted.html.twig in Manage display 8

Default theme implementation to display 'submitted' information.

This template is formed from the part of node.html.twig conditional on display_submitted. Instead of the author_name variable we insert the contents of username.html.twig.

Available variables:

  • user_picture: The rendered author user entity
  • metadata: Metadata for this entity.
  • date: Creation date field.
  • author_attributes: HTML attributes for the containing element.
  • account: The full account information for the user.
  • uid: The user ID, or zero if not a user. As used in anonymous comments.
  • name: The user's name, sanitized, and optionally truncated.
  • name_raw: The user's name, un-truncated.
  • truncated: Whether the user's name was truncated.
  • extra: Additional text to append to the user's name, sanitized.
  • profile_access: Whether the current user has permission to access this users profile page.
  • 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.
  • homepage: (optional) The home page of the account, only set for non users.
  • link_options: Options to set on the \Drupal\Core\Url object if linking the user's name to the user's page.
  • attributes: HTML attributes for the element containing the name.

File

templates/submitted.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display 'submitted' information.
  5. *
  6. * This template is formed from the part of node.html.twig conditional on
  7. * display_submitted. Instead of the author_name variable we insert the
  8. * contents of username.html.twig.
  9. *
  10. * Available variables:
  11. * - user_picture: The rendered author user entity
  12. * - metadata: Metadata for this entity.
  13. * - date: Creation date field.
  14. * - author_attributes: HTML attributes for the containing element.
  15. * - account: The full account information for the user.
  16. * - uid: The user ID, or zero if not a user. As used in anonymous comments.
  17. * - name: The user's name, sanitized, and optionally truncated.
  18. * - name_raw: The user's name, un-truncated.
  19. * - truncated: Whether the user's name was truncated.
  20. * - extra: Additional text to append to the user's name, sanitized.
  21. * - profile_access: Whether the current user has permission to access this
  22. * users profile page.
  23. * - link_path: The path or URL of the user's profile page, home page,
  24. * or other desired page to link to for more information about the user.
  25. * - homepage: (optional) The home page of the account, only set for non users.
  26. * - link_options: Options to set on the \Drupal\Core\Url object if linking the
  27. * user's name to the user's page.
  28. * - attributes: HTML attributes for the element containing the name.
  29. *
  30. * @see template_preprocess_submitted()
  31. *
  32. * @ingroup themeable
  33. */
  34. #}
  35. <footer>
  36. {{ user_picture }}
  37. <div{{ author_attributes }}>
  38. {% if link_path -%}
  39. {% if date -%}
  40. {% trans %}Submitted by <a{{ attributes }}>{{ name }}{{ extra }}</a> on {{ date }}{% endtrans %}
  41. {%- else -%}
  42. {% trans %}Submitted by <a{{ attributes }}>{{ name }}{{ extra }}</a>{% endtrans %}
  43. {%- endif -%}
  44. {%- else -%}
  45. {% if date -%}
  46. {% trans %}Submitted by <span{{ attributes }}>{{ name }}{{ extra }}</span> on {{ date }}{% endtrans %}
  47. {%- else -%}
  48. {% trans %}Submitted by <span{{ attributes }}>{{ name }}{{ extra }}</span>{% endtrans %}
  49. {%- endif -%}
  50. {%- endif -%}
  51. {{ metadata }}
  52. </div>
  53. </footer>