Closed (outdated)
Project:
Drupal core
Version:
11.x-dev
Component:
forms system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2011 at 20:40 UTC
Updated:
12 Aug 2025 at 22:51 UTC
Jump to comment: Most recent
Comments
Comment #1
sunThis does not exist, even though it's one of the topmost use-cases throughout core and contrib.
We are duplicating #attributes['class'] into #class.
Let's consider that you set #attributes['class'] in your code and someone else sets #class in their code. Who wins?
Comment #2
Everett Zufelt commented@Sun
Currently on checkbox and radio form elements you can set either ['#title'] or ['#attributes']['title'], assuming that ['#title_display'] is set to 'attribute', then #title will be rendered as the element title attribute, and not as a label element. Whatever we choose for #attributes/class -> #class should be consistent wih #attributes/title -> #title.
Comment #3
traviscarden commentedRe-tagging.
Comment #4
sunI'd love to see a patch for the essential change here. Based on that, we should be able to resolve #1.
Actual conversions of all existing code to use this new property instead of #attributes][class should happen in separate follow-up issues, as that is going to be a huge undertaking (and due to potential conflicts with other major patches in the queue, those conversions might be better scheduled for after feature freeze).
It might be possible that we can bake this into the element_set_attributes() function, which essentially performs a #property to #attributes][#property mapping/conversion already.
Comment #4.0
sunUpdating text.
Comment #5
lewisnymanComment #6
lewisnymanComment #22
smustgrave commentedThank you for sharing your idea for improving Drupal.
We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. 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 #23
smustgrave commentedSince there's been no follow up and it's a feature request going to close out. If anyone feels like working on it feel free to re-open
Thanks all!