Tag Archives: Omega

Drupal 7 – Apply sticky footer in Omega theme

We can make the section-footer sticky in Omega theme by adding the following piece of code in <your-theme>-alpha-default.css.

/* sticky footer */
html, body {height: 100%; margin: 0;}
#page {display: table; width: 100%;}
html>/**/body #page {height: 100%;}
*:first-child+html #page {height: auto;}
.section {display: table-row;}
html>/**/body .section-content {height: 100%;}
*:first-child+html body .section-content {height: auto;}

 

Kudos to Karl Kasischke.

Done =)

Reference: Has anyone tried to get a sticky footer to work with Omega?

Drupal 7 – Customize region template file for specific content type

We can add preprocess function for regions such that we can add customization before rendering the region template file(.tpl.php).
Drupal 7 – Check if the current loading page is the node view page of a specific content type

Sometimes we may even want edit the template file(.tpl.php) for specific content such as a content type node view. In Omega theme, there are different regions and by default they will use the following template files.

<drupal>/sites/all/themes/omega/omega/templates

  • region--branding.tpl.php
  • region--content.tpl.php
  • region--menu.tpl.php
  • region--sidebar_first.tpl.php
  • region--sidebar_second.tpl.php
  • region.tpl.php

Continue reading Drupal 7 – Customize region template file for specific content type

Drupal 7 – Check if the current loading page is the node view page of a specific content type

I try to preprocess the content region of the Omega theme for a specific content type. So i have to check the content type inside the <subtheme>_alpha_preprocess_region(&$vars) function so that the preprocess modification only applies to that content type. In that case, we could make use of the menu_get_object() provided by the Drupal API.
Continue reading Drupal 7 – Check if the current loading page is the node view page of a specific content type

Drupal 7 – Disable certain regions by conditions using Context

Context could help you to manage the layout. In the past, i would use the Page manager of Chaos Tool Suite and Panels to control the layout but now i have completely move to the Context module. You can decide which regions should be hidden.

However, i found that it may not work for certain regions and so i raise it in the Context project page. I will keep my eyes on it.
Context – Disable regions
Continue reading Drupal 7 – Disable certain regions by conditions using Context

Drupal 7 – Alter the site logo link in Omega theme

I was working on a Drupal 7 website with Omega theme and i want to customize the site logo link. This can be done by creating the <Omega subtheme>/process/process-region.inc.

<?php
function <theme>_alpha_process_region(&$vars) {
  if (in_array($vars['elements']['#region'], array('content', 'menu', 'branding'))) {
    switch ($vars['elements']['#region']) {
      case 'branding':
        $vars['linked_logo_img'] = $vars['logo'] ? l($vars['logo_img'], '<NEW HOME PATH>', array('attributes' => array('rel' => 'home', 'title' => check_plain($vars['site_name'])), 'html' => TRUE)) : '';
    }
  }
}

Continue reading Drupal 7 – Alter the site logo link in Omega theme