1. Open you current theme folder and add the following line in the theme.info.
Let’s recall the custom module we have created in previously.
Drupal – Create a Block
I want to create a taxonomy view which shows the term name and the term image. For those terms without term image, i want to filter out them. Unfortunately there is no term image filter in the view setting. One work around is overriding the view query by implementing the hook_views_pre_execute(&$view) in a custom module. Before you construct the new SQL, you should set all your desire settings in the view editing page first. Then you can create a new SQL base on that view query.
So in the custom module, add the following function. Continue reading Drupal – Customize the Views Query
The Taxonomy Menu allows you listing all taxonomies in a menu. You can either link the taxonomy by term id or term name. I have Pathauto installed such that each term is linked to a URL alias.
Continue reading Drupal – Override the Menu Link in Taxonomy Menu
Localization with Ubercart is somehow a bit difficult. Assume we have 2 languages, English and Traditional Chinese, installed. For a particular product, there will be one node representing the English one and the other node representing the Traditional Chinese one. If you add the English node into the cart, it will not be translated in the cart and checkout page. In other words, they are treated as 2 different products.
The following example can localize the Product content type even in the cart and checkout page. and it is based on the work by Stewart Adam. Please refer to for the post – Translating or internationalizing an Ubercart store: Common problems & solutions more information.
1. Create a custom module and add the following hook implementation in the .module file. Continue reading Drupal – Ubercart Localization
In previous posts, we created a custom module implement the hook_block() function.
We haven’t implemented the block configurable values. Let’s do it now.
We want the block to store a number and a string. so we add these 2 fields in the block configuration page. Here is the new custom.module. Continue reading Drupal – Add Configurable Values to Block
Previous related posts:
The above posts show you how to create and customized the content of a block. Sometimes, we may need to show some database data in the block. So we need to write a SQL. For example, i want to show a list of node titles and the corresponding url links of the Song content type.
1. Modify the custom.module Continue reading Drupal – Show Database Data in Block by SQL
In the Drupal template architecture, you can customized a specific block just by creating a .tpl.php file in the theme folder. For example, the block.tpl.php determine all the block layout in your Drupal theme.
We can also override the design layout of the block in our customized module which we created yesterday(Drupal – Create a Block). First we have to create the corresponding .tpl.php for our block. In this case, we need a block-[module-name].tpl.php.
So create the block-custom.tpl.php
<!-- get the block details from the $block variable -->
<p>Subject:<?php print $block->subject ?></p>
<p>Content:<?php print $block->content ?></p>
Continue reading Drupal – Customize Block Template File
You can create your own block and customized its content. Drupal provides the hook_block() function for block creation. We can implement this function in our customized module.
1. Create a customized module by creating the following files.
name = Custom module
description = A custom module which create a block
core = 6.x
Continue reading Drupal – Create a Block