Just like custom CSS classes are allowed on field cells, it would be great to allow custom CSS classes on column and row headers. Patch to follow.


infojunkie’s picture

Status: Active » Needs review
4.45 KB

Patch attached. It adds 2 options to the style plugin, namely ['xconfig']['class'] and ['yconfig']['class'] with their corresponding form elements. During rendering, these extra classes are rendered in the headers via the new method views_matrix_plugin_style_matrix::headerClasses.

mradcliffe’s picture

Status: Needs review » Needs work
+++ b/includes/views-view-matrix.tpl.php
@@ -18,7 +18,7 @@
+        <th <?php print drupal_attributes($col_header['attributes']); ?>><?php print $col_header['data']; ?></th>

This isn't introduced in this patch, but when applying and testing the patch I ran into the following.

The first time I create a view and select Matrix from the Views Wizard, preview borks because $col_header['attributes'] is a string and not an array.

It's probably another bug in views_matrix. I'll look into it and post an updated patch.

mradcliffe’s picture

Status: Needs work » Needs review
4.48 KB
539 bytes

explode() will return FALSE when the second argument is an empty string.

This should do it.

infojunkie’s picture

Status: Needs review » Reviewed & tested by the community

Works for me. Thanks!

  • mradcliffe committed 888fff4 on 7.x-1.x
    Issue #2330435 by infojunkie, mradcliffe: Add support for custom classes...
mradcliffe’s picture

Status: Reviewed & tested by the community » Fixed


Status: Fixed » Closed (fixed)

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