file-managed-file.html.twig
Same filename in this branch
- 10 core/profiles/demo_umami/themes/umami/templates/classy/content-edit/file-managed-file.html.twig
- 10 core/themes/stable9/templates/content-edit/file-managed-file.html.twig
- 10 core/themes/starterkit_theme/templates/content-edit/file-managed-file.html.twig
- 10 core/modules/file/templates/file-managed-file.html.twig
Same filename in other branches
- 9 core/profiles/demo_umami/themes/umami/templates/classy/content-edit/file-managed-file.html.twig
- 9 core/themes/stable9/templates/content-edit/file-managed-file.html.twig
- 9 core/themes/seven/templates/classy/content-edit/file-managed-file.html.twig
- 9 core/themes/claro/templates/content-edit/file-managed-file.html.twig
- 9 core/themes/bartik/templates/classy/content-edit/file-managed-file.html.twig
- 9 core/themes/stable/templates/content-edit/file-managed-file.html.twig
- 9 core/themes/starterkit_theme/templates/content-edit/file-managed-file.html.twig
- 9 core/themes/classy/templates/content-edit/file-managed-file.html.twig
- 9 core/modules/file/templates/file-managed-file.html.twig
- 8.9.x core/profiles/demo_umami/themes/umami/templates/classy/content-edit/file-managed-file.html.twig
- 8.9.x core/themes/seven/templates/classy/content-edit/file-managed-file.html.twig
- 8.9.x core/themes/claro/templates/content-edit/file-managed-file.html.twig
- 8.9.x core/themes/bartik/templates/classy/content-edit/file-managed-file.html.twig
- 8.9.x core/themes/stable/templates/content-edit/file-managed-file.html.twig
- 8.9.x core/themes/classy/templates/content-edit/file-managed-file.html.twig
- 8.9.x core/modules/file/templates/file-managed-file.html.twig
- 11.x core/profiles/demo_umami/themes/umami/templates/classy/content-edit/file-managed-file.html.twig
- 11.x core/themes/stable9/templates/content-edit/file-managed-file.html.twig
- 11.x core/themes/claro/templates/content-edit/file-managed-file.html.twig
- 11.x core/themes/starterkit_theme/templates/content-edit/file-managed-file.html.twig
- 11.x core/modules/file/templates/file-managed-file.html.twig
Theme override to display a file form widget.
Available variables:
- main_items: Main render elements of the file or image widget: file name, upload input, upload and remove buttons and hidden inputs.
- data: Other render elements of the image widget like preview, alt or title, or the description input and the display checkbox of the file widget.
- display: A flag indicating whether the display field is visible.
- attributes: HTML attributes for the containing element.
- multiple: Whether this widget is the part of a multi-value file widget or not.
- upload: Whether the file upload input is displayed or not.
- has_value: true if the widget already contains a file.
- has_meta: true when the display checkbox or the description, alt or title inputs are enabled and at least one of them is visible.
See also
template_preprocess_file_managed_file()
claro_preprocess_file_managed_file()
1 theme call to file-managed-file.html.twig
- ManagedFile::getInfo in core/
modules/ file/ src/ Element/ ManagedFile.php
File
-
core/
themes/ claro/ templates/ content-edit/ file-managed-file.html.twig
View source
- {#
- /**
- * @file
- * Theme override to display a file form widget.
- *
- * Available variables:
- * - main_items: Main render elements of the file or image widget:
- * file name, upload input, upload and remove buttons and hidden inputs.
- * - data: Other render elements of the image widget like preview, alt or title,
- * or the description input and the display checkbox of the file widget.
- * - display: A flag indicating whether the display field is visible.
- * - attributes: HTML attributes for the containing element.
- * - multiple: Whether this widget is the part of a multi-value file widget or
- * not.
- * - upload: Whether the file upload input is displayed or not.
- * - has_value: true if the widget already contains a file.
- * - has_meta: true when the display checkbox or the description, alt or title
- * inputs are enabled and at least one of them is visible.
- *
- * @see template_preprocess_file_managed_file()
- * @see claro_preprocess_file_managed_file()
- */
- #}
- {%
- set classes = [
- 'js-form-managed-file',
- 'form-managed-file',
- multiple ? 'is-multiple' : 'is-single',
- upload ? 'has-upload' : 'no-upload',
- has_value ? 'has-value' : 'no-value',
- has_meta ? 'has-meta' : 'no-meta',
- ]
- %}
- <div{{ attributes.addClass(classes).removeClass('clearfix') }}>
- <div class="form-managed-file__main">
- {{ main_items.filename }}
- {{ main_items|without('filename') }}
- </div>
-
- {% if has_meta or data.preview %}
- <div class="form-managed-file__meta-wrapper">
- <div class="form-managed-file__meta">
- {% if data.preview %}
- <div class="form-managed-file__image-preview image-preview">
- <div class="image-preview__img-wrapper">
- {{ data.preview }}
- </div>
- </div>
- {% endif %}
-
- {% if data.description or display or data.alt or data.title %}
- <div class="form-managed-file__meta-items">
- {{ data.description }}
- {% if display %}
- {{ data.display }}
- {% endif %}
- {{ data.alt }}
- {{ data.title }}
- </div>
- {% endif %}
- </div>
- </div>
- {% endif %}
-
- {# Every third-party addition will be rendered here. #}
- {{ data|without('preview', 'alt', 'title', 'description', 'display') }}
- </div>
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.