Problem/Motivation

Several drupal theme functions result in exactly the same markup structures.

<div class="{{ attributes.class }}" {{ attributes }}>{{ children }}</div>

As we convert to twig we should take the opportunity to consolidate what can be consolidated, and add theme_hook suggestions where particular instances of these structures may need to be overridden independently.

Proposed resolution

Implement theme('container') wherever possible, and add theme_hook_suggestions for all variations, including:

Remaining tasks

#2041825: Remove theme_radios() and call theme('container') instead
#2041845: Remove theme_checkboxes() and call theme('container') instead

Related tasks

#939462: Specific preprocess functions for theme hook suggestions are not invoked
#1751194: Introduce hook_theme_suggestions[_HOOK]() and hook_theme_suggestions[_HOOK]_alter()
#1804614: [meta] Consolidate theme functions and properly use theme suggestions in core
#1285506: Radios select in form dont have unique wrapper class
#1898480: [meta] form.inc - Convert theme_ functions to Twig

User interface changes

None.

API changes

TBD

Comments

jenlampton’s picture

Title: radios.html.twig and checkboxes.html.twig should be consolidated » Consolidate all form element theme functions that use containers
Component: routing system » theme system

Updating title.

jenlampton’s picture

Issue summary: View changes

added info about container.html.twig

jenlampton’s picture

Title: Consolidate all form element theme functions that use containers » [meta] Consolidate all form element theme functions that use containers

updating again :/

jenlampton’s picture

Title: [meta] Consolidate all form element theme functions that use containers » [meta] Consolidate all form element container templates, and add theme_hook_suggestions
Assigned: Unassigned » jenlampton

updating title.

jenlampton’s picture

Issue summary: View changes

add links to api.drupal.org

jenlampton’s picture

Issue summary: View changes

issue summary

jenlampton’s picture

Issue summary: View changes

clean

c4rl’s picture

jenlampton’s picture

Issue tags: +Template consolidation

tagging

jenlampton’s picture

Issue summary: View changes

related

jenlampton’s picture

Issue summary: View changes

add element

jenlampton’s picture

Issue summary: View changes

sub issues

jenlampton’s picture

Issue summary: View changes

reorg

mitokens’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

JohnAlbin’s picture

Issue summary: View changes

#1114398: Form element & Form element label theming is broken was fixed in D8. Removing it from the issue summary.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.