Changing Content Colum Class on page.vars.php Drupal 7
I have installed Bootstrap 3 as a subtheme, then i have a problem with column class when i add a new region on my bootstrap subtheme, i added a new region with the name sidebar_three. The new region actually appeared well, but the colum class bootstrap is not working as i expected. Column class have a default value with col-sm-12 while i want column class to have class with default value col-sm-9 when sidebar_three region exist.
I tried various ways to solve this problem, I trying to do a costum template on the template.php file but not change and i know if i change directly on the page.vars.php file it works, but it's probably not a good way, and finally i tried another way
I added a logic to the page.tpl.php on my subtheme bootstrap and then saving a new class form column with the following code :
<?php if (!empty($page['sidebar_first']) || (!empty($page['sidebar_three']))): ?>
<aside class="col-sm-3" role="complementary">
<?php print render($page['sidebar_three']); ?>
<?php print render($page['sidebar_first']); ?>
</aside> <!-- /#sidebar-first1 -->
<?php endif; ?>
<?php
# Saving a new class for section class
if(!empty($page['sidebar_first']) && !empty($page['sidebar_second'])) {
$myclass ='col-sm-6';
}elseif (!empty($page['sidebar_first']) || !empty($page['sidebar_second']) || !empty($page['sidebar_three'])){
$myclass='col-sm-9';
}else{
$myclass='col-sm-12';
}
/** before <section<?php print $content_column_class; ?>> **/
?>
<section class="<?php print $myclass;?>">
the above method worked well form me.
0 Response to "Changing Content Colum Class on page.vars.php Drupal 7"
Post a Comment
Komentar yang Anda kirim akan terlebih dahulu di moderasi oleh Admin