Posted by mepperly on June 30, 2015 at 12:03am
I know that Bootstrap3 isn't compatible with older versions of IE, but I have everything else working with IE9 except menuing and the Display Suite Bootstrap3 layouts.
Any ideas about a good fix for either, but especially the DS layouts? Everything is rendering in one long column with no sidebars (most of the site uses 8-4 ds-bootstrap 3 layout).
I have already implemented the html5 shiv, tried installing boxsizing.htc, and added this to my meta area, right below the head: " ."
Meg
Comments
I'm just trying out some DS layouts...
In my case I have assigned a DS layout to Paragraph types, and want to get them to behave in an existing 'bootstrappy' site. From the templates it looked like this should be possible without copying and altering templates. Here's what I came up with, after tracing some code:
1) Disable Layouts CSS styles (there's a checkbox in the 'manage display' UI). That means: don't add DS standard CSS definitions for column widths, because my theme supposedly already has the correct definitions for column widths.
2) this alter hook (which you'll need to modify to suit your purpose: apparently you need to deduce your DS layout by checking entity type + bundle). I like writing comments with my hacks, so see below.
<?php/**
* Implements hook_ds_pre_render().
*/
function MYTHEME_ds_pre_render_alter(&$layout_render_array, $context, &$vars) {
// We don't have the DS layout name here, so we need to check entity type/
// bundle. The connection to the display settings we have made in this site,
// is implicit.)
if (isset($vars['elements']['#entity_type'])
&& isset($vars['elements']['#bundle'])
&& $vars['elements']['#entity_type'] === 'paragraphs_item') {
switch ($vars['elements']['#bundle']) {
// Add some (bootstrap) classes to columns in a DS layout template.
// Notes:
// - We can't do this in a theme preprocess function like
// THEME_preprocess_ds_3col_equal_width() (which officially does exist)
// because the actual theme hook executed is 'entity'. The theme
// suggestions only pick up which template (e.g. 'ds_3col_equal_width')
// to use, after having run (pre)process functions for 'entity'.
// - we need to start the classes with a space; seems like a template bug.
case '3col':
$vars['left_classes'] = $vars['middle_classes'] =
$vars['right_classes'] = ' col-md-6 col-sm-6 col-xs-12';
break;
case 'image_left':
case 'image_right':
$vars['left_classes'] = $vars['right_classes'] = ' col-md-6 col-sm-12 col-xs-12';
break;
}
}
}
?>