Problem/Motivation
There are way too many theme functions / template files in core. Some are similar (if not identical) and should be consolidated.
Proposed resolution
We have two options:
- Remove theme_radios() and call
theme('container')instead (build a render array with'#theme' => 'container') - If we really do need a separate preprocess function for this, let's use
theme('container__radios')instead oftheme('container')and add all our preprocess magic intotemplate_preprocess_container__radios()
Remaining tasks
Decide which of the 2 options above to pursue, and do it.
User interface changes
None
API changes
Removal of theme_radios
Related Issues
#1819284: [meta] Consolidate all form element container templates, and add theme_hook_suggestions
#2041845: Remove theme_checkboxes() and call theme('container') instead
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | remove_theme_radios-2041825-19.patch | 3.3 KB | manuel garcia |
| #12 | 2041825-12-remove-theme_radios.patch | 3.51 KB | SebCorbin |
| #9 | 2041825-9-remove-theme_radios.patch | 4.49 KB | SebCorbin |
| #7 | 2041825-Remove-theme_radios-7.patch | 2.41 KB | manuel garcia |
| #3 | 2041825-Remove-theme_radios-3.patch | 3.09 KB | ericduran |
Comments
Comment #1
ericduran commentedPatch coming
Comment #2
ericduran commentedStill waiting for local test to finish but so far seems like no test changes are needed.
Two things:
- Change radios element theme_wrapper from theme_radios to theme_container.
- Added a new class to theme_container so it'll generically add the form- {form-type} class.
Comment #3
ericduran commentedFixing issues with extra attributes such as #disable getting passed in to the container.
Comment #5
dsnopek#3: 2041825-Remove-theme_radios-3.patch queued for re-testing.
Comment #6.0
(not verified) commentedrelated
Comment #7
manuel garcia commented#2152221: Convert theme_radios() to Twig got in.
Attached a patch which:
temeplate_preprocess_radiosLooking at the patch on #3,
theme_containerwas moved intotemplate_preprocess_container- not sure we need to do anything extra in the preprocessor anymore? classes etc?Comment #9
SebCorbin commentedDifference on Radio (single)
Added this code in template_preprocess_container() but it seems wrong to me
Comment #10
quicksketchThe replacement here should be
'#theme_wrappers' => array('container__radios'),, so theme_container will be used by default but users can use the suggestion of container--radios.html.twig if they want to target radios directly.Comment #11
quicksketchThis patch should also remove the entry for "radios" from drupal_common_theme().
Comment #12
SebCorbin commentedMoved special behavior to theme_container__radios as per #10 and #11
Comment #14
SebCorbin commentedNeed to wait for another issue
Comment #15
mitokens commentedComment #16
andriyun commentedComment #17
andypostComment #18
manuel garcia commentedRerolling...
Comment #19
manuel garcia commentedComment #21
manuel garcia commentedMarkup before patch:
After:
Comment #22
star-szrI don't think we can remove any theme hooks in D8, but we can probably come up with a strategy for phasing certain ones out…
Comment #23
manuel garcia commented:'(
Comment #24
star-szrBackwards compatibility!
Comment #25
manuel garcia commentedHeheh I understand - only sorry I didn't put more time into this at the time =)
Comment #26
andypostAny idea how to make it BC way?
Comment #42
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #43
smustgrave commentedWanted to bump this one more time if still needed.