Closed (duplicate)
Project:
Views (for Drupal 7)
Version:
8.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Apr 2012 at 03:10 UTC
Updated:
22 Oct 2012 at 22:10 UTC
I'm trying to add a CSS class to some tables, based on their HTML-ID, but it's not working.
function mytheme_preprocess_table(&$variables) {
// Add foo class to tables.
$variables['attributes']['class'][] = 'foo';
krumo($variables);
}
Is there any reason why this is not possible? How can this solved?
Comments
Comment #1
cr0ss commentedWhat are the tables you trying to preprocess like this?
If they are rendered by views for example - template_preprocess_table will not work, because view uses own theming function for tables.
Comment #2
hass commentedI need to add this to every table in the system. Why should a table in views not use the standard theme functions? That's why we have theme functions, isn't it? :-) I think I tried this on several views tables...
Comment #4
cr0ss commentedSee sites/all/modules/contrib/views/theme. Though I'm agree this could be useful to have default theme_table as part of views' theming function.
Comment #5
hass commentedI give it a try and move the case to views than. Thx
Comment #6
sunComment #7
hass commentedComment #8
dawehnerViews is not using theme_table, so template_preprocess_table is not working.
Use hook_preprocess_views_view_table instead.
Comment #9
hass commentedThat's the problem. Views should use the core functions and not complicate things.
Comment #10
dawehnerI will certainly ignore this issue, sorry.
Comment #11
hass commentedThat are the reasons why views is not ready for D8 core.
Comment #12
dawehnerThe world is a place of free oppinions, so feel free to contribute in a constructive way.
Comment #13
hass commentedWe are required to re-use core API function to make something core worthy. These are written rules.
Comment #14
damiankloip commentedYou are welcome to write a reviewable patch for this. Otherwise not sure 'We are required' is accurate...
Comment #15
tim.plunkettRemoving tag.
Comment #16
hass commentedVDC = Views Drupal Core? This is a blocker
Comment #17
xjmThis is a worthwhile feature request, but it is not a bug, and it is definitely not a blocker.
Comment #18
xjmClosing as duplicate of #1815824: Use theme_table() for views tables.