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');
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JacobSingh’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch failed testing.

Dries’s picture

Status: Needs work » Needs review

This 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.

JacobSingh’s picture

I 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.

catch’s picture

Status: Needs review » Needs work

Looks good, just needs tests to pass and that documentation.

JacobSingh’s picture

Status: Needs work » Needs review

Setting to needs review... does the bot run on needs work?

catch’s picture

Category: feature » task

whoops, cross-posted, and no it doesn't.

Bojhan’s picture

Mr. Bot?

JacobSingh’s picture

What is up with the Bot?

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Let's get this functionality in. :)

(And I'm not a Bot!) :P

tic2000’s picture

Status: Reviewed & tested by the community » Needs review

Since you are not a bot ;)

Dries’s picture

If someone runs the tests locally, that is good enough too. Not sure Joshua did.

Dries’s picture

Testing was OK, see http://testing.drupal.org/pifr/file/1/tableselect_row_attributes_1.diff (thanks DamZ) but somehow not reported on d.o.

Dries’s picture

Committed to CVS HEAD. Thanks!

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.