0

I'm new at Drupal and am building a site with the Bootstrap theme, and i would like to place the user login and user menu in the lower right corner. Unfortunately there is no region for that, there is just the footer region which covers the whole width of the screen

What is the best way for me to add the user login and user menu to this area?

This would have been a problem if i just wanted to place the user login and user menu below, because when setting contents of the blocks they are placed vertically on top of each other. But in my case this wouldn't look good, i would need the stacking to be done horizontally instead of vertically

I can think of two different approaches:

  1. Modifying the bootstrap theme so that there is a region in the lower right
  2. Modifying the code of the footer to include the content of the "user login" and "user menu" blocks (maybe using this as a guide)
  3. Maybe using the panels module?
  4. Somehow getting the stacking to be done horizontally rather than vertically

Which of these would you recommend? Are there other approaches that are better?

It's important that the site is easy to maintain long-term and that we can continue to use the auto-update for the bootstrap theme

Grateful for any suggestions!

1

Never directly use the Bootstrap theme, create a subtheme from one of the starterkits inside your theme folder (they have readme files inside the starterkits with more info and relevant links depending on which method you prefer to use), and do all your work in the subtheme. This way you can auto-update the bootstrap theme, without loosing all your customisations.

Next step would be to create your own region (for example Footer right) in the info file of your subtheme:

;;;;;;;;;;;;;;;;;;;;;
;; Regions
;;;;;;;;;;;;;;;;;;;;;

regions[navigation]     = 'Navigation'
regions[header]         = 'Top Bar'
regions[highlighted]    = 'Highlighted'
regions[help]           = 'Help'
regions[content]        = 'Content'
regions[sidebar_first]  = 'Primary'
regions[sidebar_second] = 'Secondary'
regions[footer]         = 'Footer'

regions[footer_right]   = 'Footer right'

regions[page_top]       = 'Page top'
regions[page_bottom]    = 'Page bottom'

Next create the region in your page.tmpl.php file. You should override the one used in the Bootstrap theme, with a duplicate you make in your subtheme: YOUR_SUBTHEME/templates/system/page.tpl.php. (Copy the file you have in YOUR_SUBTHEME/bootstrap/system/page.tpl.php)

Go to the footer section in this page.tpl.php file, it should look somewhat like this:

<?php if (!empty($page['footer'])): ?>
  <footer class="footer <?php print $container_class; ?>">
   <div class="container">
    <?php print render($page['footer']); ?>
   </div>
  </footer>
<?php endif; ?>

And add your new region where you would like it to go (for instance like this), and use the Bootstrap markup to align your content to the right:

<?php if (!empty($page['footer'])): ?>
  <footer class="footer <?php print $container_class; ?>">

   <?php if (!empty($page['footer_right'])): ?>
    <div class="container">
     <div class="col-xs-6 col-xs-offset-6 col-sm-4 col-sm-offset-8">
      <?php print render($page['footer_right']); ?>
     </div>
    </div>
   <?php endif; ?>

   <div class="container">
    <?php print render($page['footer']); ?>
   </div>
  </footer>
<?php endif; ?>

Make sure to clear your sites cache when you're doing changes to template files like these. If all is fine, your new region should appear in "structure > blocks", and you should be able to add your login blocks to it.

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.