Add summary attribute to tables

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
3.82 KB

It would make sense for grid, too.

mgifford’s picture

Ok, this looks good when I review the code, but I want to apply it to my sandbox and need to know what version of the code I'm applying it against.

dawehner’s picture

It's filled against views 3.x but i guess it should work for 2.x, too.

mgifford’s picture

FileSize
223.96 KB
133.53 KB

Ok, I'd recommend a bit of a change in the patch in this line:

+  $vars['attributes'] = drupal_attributes(array('summary' => $handler->options['summary']));

as you don't want a blank tag if it isn't required.

+  $vars['attributes'] = (!empty($handler->options['summary'])) ? drupal_attributes(array('summary' => $handler->options['summary'])) : '';

I added it to a D6 sandbox here http://drupal6.dev.openconcept.ca/en/table

And ran into two problems. One was that I noticed that there was an empty <h2> tag. but that's another issue for views accessibility not to be addressed here.

Big issue here was that the summary table was blank in the output.

I looked at the code briefly to figure out why, but came up blank.

EDIT: First image shows the form as it is displayed in the views admin with the summary field added. The 2nd image however displays the empty summary text & empty header ( all marked up with http://wave.webaim.org )

Everett Zufelt’s picture

What tables? Tables within the Views UI, tables generated by views? What functionality does this patch attempt to add?

It is difficult for people to test without knowing expected behaviors and output.

dawehner’s picture

This issue is about tables generated by views.

The goal of the issue is that the page developer/administrator can set a summary attribute for tables. Does this help?

merlinofchaos’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)
FileSize
5.99 KB

Made mgifford's change and committed. Doesn't apply to 7.x so needs porting.

I couldn't reproduce the issue mgifford saw. My best guess is that the view wasn't actually fully saved, so the changes weren't being shown on the real view. Changing the summary worked correctly for me in preview.

Actual patch applied is attached.

mgifford’s picture

Thanks, this is great to hear. I don't have time to look at this now, but will try to do so and get back to you if I can replicate the problem.

dawehner’s picture

Status: Patch (to be ported) » Fixed

Ported.

Tested with both grid and table.

Status: Fixed » Closed (fixed)

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