Created
July 9, 2012 06:22
-
-
Save cafuego/3074521 to your computer and use it in GitHub Desktop.
Drupal 7 Views Grid Preprocessor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_preprocess_views_view_grid(). | |
* | |
* Our own implementation removes the complete.css grid class names from | |
* the views grid and uses different ones instead. | |
* | |
* Specifically: col-N => view-col-N | |
*/ | |
function phptemplate_preprocess_views_view_grid(&$vars) { | |
$replace = array(); | |
for ($i = 1; $i <= ($vars['view']->style_options['columns']); $i++) { | |
$replace['col-'. $i .' '] = 'view-col-' . $i . ' '; | |
$replace['col-'. $i] = 'view-col-' . $i; | |
} | |
foreach ($vars['column_classes'] as &$row) { | |
foreach ($row as $column => &$classes) { | |
$classes = strtr($classes, $replace); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment