Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This patch allows you to provide an #attributes array in your #options of a tableselect type to do things like add classes to rows, etc.
Example:
$options[$name]['title'] = "my option"
$options[$name]['type'] = "something else"
$options[$name]['#attributes'] = array ('class' => 'super duper');
Comment | File | Size | Author |
---|---|---|---|
#4 | tableselect_row_attributes.diff | 1.96 KB | JacobSingh |
tableselect_row_attributes.diff | 1.47 KB | JacobSingh | |
Comments
Comment #1
JacobSingh CreditAttribution: JacobSingh commentedComment #3
Dries CreditAttribution: Dries commentedThis patch looks simple, but I'd like to see us extend the PHPdoc a bit to explain why you might care about passing in an '#attributes' array. Should be RTBC with more extensive documentation.
Comment #4
JacobSingh CreditAttribution: JacobSingh commentedI think those are E_NOTICE exceptions... this should fix them.
Also, added an example and some docs. Real docs should actually go on the form api reference page though.
Comment #5
catchLooks good, just needs tests to pass and that documentation.
Comment #6
JacobSingh CreditAttribution: JacobSingh commentedSetting to needs review... does the bot run on needs work?
Comment #7
catchwhoops, cross-posted, and no it doesn't.
Comment #8
Bojhan CreditAttribution: Bojhan commentedMr. Bot?
Comment #9
JacobSingh CreditAttribution: JacobSingh commentedWhat is up with the Bot?
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commentedLooks good. Let's get this functionality in. :)
(And I'm not a Bot!) :P
Comment #11
tic2000 CreditAttribution: tic2000 commentedSince you are not a bot ;)
Comment #12
Dries CreditAttribution: Dries commentedIf someone runs the tests locally, that is good enough too. Not sure Joshua did.
Comment #13
Dries CreditAttribution: Dries commentedTesting was OK, see http://testing.drupal.org/pifr/file/1/tableselect_row_attributes_1.diff (thanks DamZ) but somehow not reported on d.o.
Comment #14
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!
Comment #15
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks!