1

I am new to drupal theme development . I am customizing a sub theme of zen and wants to change the background of sidebar-first. So I want to know where this sidebar_first render array is defined and how can I add the CSS class to whole sidebar-first also to the nodes within the sidebar_first render array ?

I tried within my templates template.php :

function zensub_page_alter(&$page) {
 $page['sidebar_first'] = array(
 '#attributes' => array('class' => 'page-columns')
 );
}

But this causes the sidebar-first remove !

1
3

Create a template file with name region--sidebar-first.tpl.php in side the your theme template folder. Copy below code to inside the newly created template file

<?php if ($content): ?>
     <div class="my_class <?php print $classes; ?>">
       <?php print $content; ?>
     </div>
  <?php endif; ?>

replace my_class with you desire class name, clear the drupal cache. It will wrap a new class on the sidebar first region. Good luck

1
  • Thanks Madhurjya...one more question, can you tell me where the render array sidebar_first is defined ? I searched everywhere but can't find the array ! – Nitish Dec 28 '13 at 5:24

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.