Remove usages of #theme_wrappers

Created on 27 April 2016, over 8 years ago
Updated 10 March 2023, almost 2 years ago

Problem/Motivation

From #2702061: Unify & simplify render & theme system: component-based rendering (enables pattern library, style guides, interface previews, client-side re-rendering) .

Fabianx:

One thing that should be deprecated ASAP is theme_wrappers as you can always use an upper level instead and its super confusing to have #theme and #theme_wrappers at the same level with the theme wrapper having not available most variables needed for context.

Proposed resolution

This is all the references in core, some of these will be docs/API support and not removable, but should try to convert the rest:

core/lib/Drupal/Core/Datetime/Element/Datelist.php
core/lib/Drupal/Core/Datetime/Element/Datetime.php
core/lib/Drupal/Core/Form/FormBuilder.php
core/lib/Drupal/Core/Form/FormBuilderInterface.php
core/lib/Drupal/Core/Render/Element/Actions.php
core/lib/Drupal/Core/Render/Element/Ajax.php
core/lib/Drupal/Core/Render/Element/Button.php
core/lib/Drupal/Core/Render/Element/Checkbox.php
core/lib/Drupal/Core/Render/Element/Checkboxes.php
core/lib/Drupal/Core/Render/Element/Color.php
core/lib/Drupal/Core/Render/Element/CompositeFormElementTrait.php
core/lib/Drupal/Core/Render/Element/Container.php
core/lib/Drupal/Core/Render/Element/Date.php
core/lib/Drupal/Core/Render/Element/Details.php
core/lib/Drupal/Core/Render/Element/Dropbutton.php
core/lib/Drupal/Core/Render/Element/Email.php
core/lib/Drupal/Core/Render/Element/Fieldset.php
core/lib/Drupal/Core/Render/Element/File.php
core/lib/Drupal/Core/Render/Element/Form.php
core/lib/Drupal/Core/Render/Element/ImageButton.php
core/lib/Drupal/Core/Render/Element/Item.php
core/lib/Drupal/Core/Render/Element/MachineName.php
core/lib/Drupal/Core/Render/Element/MoreLink.php
core/lib/Drupal/Core/Render/Element/Number.php
core/lib/Drupal/Core/Render/Element/Password.php
core/lib/Drupal/Core/Render/Element/PasswordConfirm.php
core/lib/Drupal/Core/Render/Element/Radio.php
core/lib/Drupal/Core/Render/Element/Radios.php
core/lib/Drupal/Core/Render/Element/RenderElement.php
core/lib/Drupal/Core/Render/Element/Search.php
core/lib/Drupal/Core/Render/Element/Select.php
core/lib/Drupal/Core/Render/Element/SystemCompactLink.php
core/lib/Drupal/Core/Render/Element/Tel.php
core/lib/Drupal/Core/Render/Element/Textarea.php
core/lib/Drupal/Core/Render/Element/Textfield.php
core/lib/Drupal/Core/Render/Element/Url.php
core/lib/Drupal/Core/Render/Element/VerticalTabs.php
core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
core/lib/Drupal/Core/Render/Renderer.php
core/lib/Drupal/Core/Render/RendererInterface.php
core/lib/Drupal/Core/Theme/ThemeManager.php
core/modules/block/src/BlockListBuilder.php
core/modules/contact/src/MessageForm.php
core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php
core/modules/file/file.field.inc
core/modules/file/src/Element/ManagedFile.php
core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
core/modules/filter/src/Element/TextFormat.php
core/modules/filter/src/FilterFormatFormBase.php
core/modules/forum/src/Form/ForumForm.php
core/modules/language/language.module
core/modules/system/src/Tests/Common/RenderElementTypesTest.php
core/modules/system/src/Tests/Theme/ThemeTest.php
core/modules/system/templates/container.html.twig
core/modules/toolbar/toolbar.api.php
core/modules/views/src/Element/View.php
core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
core/modules/views/src/Plugin/views/filter/FilterPluginBase.php
core/modules/views/src/Plugin/views/sort/SortPluginBase.php
core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
core/modules/views_ui/src/Form/Ajax/AddHandler.php
core/modules/views_ui/src/Form/Ajax/ConfigHandler.php
core/modules/views_ui/src/Form/Ajax/ConfigHandlerExtra.php
core/modules/views_ui/src/Form/Ajax/ConfigHandlerGroup.php
core/modules/views_ui/src/Form/Ajax/Display.php
core/modules/views_ui/src/Form/Ajax/EditDetails.php
core/modules/views_ui/src/ViewEditForm.php
core/modules/views_ui/src/ViewPreviewForm.php
core/modules/views_ui/views_ui.module
core/tests/Drupal/Tests/Core/Render/RendererTest.php
core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
core/themes/classy/templates/form/container.html.twig
core/themes/stable/templates/form/container.html.twig

Remaining tasks

User interface changes

API changes

Data model changes

🌱 Plan
Status

Active

Version

10.1

Component
Theme 

Last updated about 13 hours ago

Created by

🇬🇧United Kingdom catch

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    What is the proposed alternative here.

    E.g. considering \Drupal\Core\Render\Element\CompositeFormElementTrait::preRenderCompositeFormElement that is used to wrap e.g. Radios elements in a fieldset. In that case we have #theme_wrappers of radios as well as #theme_wrappers fieldset

    Are we proposing we'd combine both of those into a theme hook like fieldset__radios or just radios and duplicate any preprocessing and consolidate the templates too?

  • 🇫🇮Finland lauriii Finland

    The decorator pattern proposal in #20 is interesting. It would provide similar functionality by using a widely used software design pattern. As explained by #20, the problem isn't the wrapping itself, but it's more that the way it's done right now is pretty confusing.

Production build 0.71.5 2024