1

I am currently using https://www.drupal.org/project/views_bootstrap and successfully created a Bootstrap Grid

For each grid item I get the following output as the root most div tag

<div class="col col-lg-4">

But I need to add more class names as follows

<div class="col-lg-4 col-md-4 col-sm-12">

is there a facility to provide additional classes which needs to be added in the root component of each rendered view content?

0

I had a similar issue some months ago. It seems Bootstrap Views allows this possibility, but only in the dev release, not in the latest stable release.

In order to do what I wanted in the stable release of the module, I ended up with the following solution:

/**
 * Implements preprocess_views_view__VIEW().
 */
function scicnet_preprocess_views_view__MY_VIEW(&$vars) {
  $display_id = $vars['display_id'];
  switch ($display_id) {
    case 'MY_DISPLAY':
      $vars['rows'] = str_replace('col-lg-4', 'col-lg-4 col-md-4 col-sm-12', $vars['rows']);
      break;
  }
}

Not the most elegant solution, I admit, but it does the job...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.