By default, the panes in the checkout form are collapsible. if you want to remove the collapsible features, you could customize the theme_uc_cart_checkout_form($form) function in your theme template.php. Continue reading Drupal – Disable the Collapsible in Ubercart Checkout Panes
Tag Archives: Drupal Development
Drupal – Customized the User Registration Form
For the Drupal registration form, there is no .tpl.php template file for editing the registration form layout. So if you want to add more HTML code around the form, you have to do it on code level.
I found a useful post about modifying the registration form. It make use of the template.php in the theme folder to theme the form. For more information. Please visit Drupal – Custom registration page theme.
In this post, i will modify the registration form by creating a custom module. Continue reading Drupal – Customized the User Registration Form
Drupal – Remove the Tabs in User Registration Form
By default, there are some tabs in the user registration form as depicted in the following picture.
Continue reading Drupal – Remove the Tabs in User Registration Form
Drupal – Create a Simple Form
Drupal provides a powerful form API for form generation. In this post, i will show you how to create a simple form and log it in watchdog whenever the form button is clicked.
First of all, let’s create a new module, name it as custommod and implement the following 2 functions. Continue reading Drupal – Create a Simple Form
Drupal – Redirect when Missing Node Translation
The following code help displaying a warning message and redirect to the site home page if a node translation does not exist. Create a custom module and implement the hook_init() method as follow. Continue reading Drupal – Redirect when Missing Node Translation
Drupal – Define Your Own Cron Job
How does the cron job in Drupal work? Let’s take a look.
cron.php
<?php // $Id: cron.php,v 1.36 2006/08/09 07:42:55 dries Exp $ /** * @file * Handles incoming requests to fire off regularly-scheduled tasks (cron jobs). */ include_once './includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); drupal_cron_run();
Looks simple, right? the drupal_cron_run() function will run the default Drupal cron tasks as well as invoking the hook_cron() in all modules. Continue reading Drupal – Define Your Own Cron Job
Drupal – Add Task to the Drupal Cron Job
Drupal has a cron.php at the root directory. you can run the this cron job by either entering the http://<drupal_root>/cron.php in browser or running it directly in the Drupal status report.
The default Drupal cron job cleans up log files and checks for Drupal and modules updates. If you want this cron job to be run at a regular interval, just edit the crontab by the following command.
- crontab -e
and add one of the following lines with you desired interval. (45 mins in the following example) Continue reading Drupal – Add Task to the Drupal Cron Job
Drupal – Get URL Arguments in Custom module or Views Template
You can get the URL arguments in custom module or views template files. Create a custom module and use the hook_nodeapi to print the URL arguments.
/**
* Implementation of hook_nodeapi()
*/
function custom_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'view':
print arg(0);
print "<br/>";
print arg(1);
break;
}
}
Continue reading Drupal – Get URL Arguments in Custom module or Views Template
Drupal – Customize a Specific View Layout by Views Template
Sometimes we need to change the view template file (.tpl.php) in order to customized the layout of the specific view. Before you start editing, you have to find out the corresponding .tpl.php for your view. This can be found in the Views setting page as shown below. Continue reading Drupal – Customize a Specific View Layout by Views Template
Drupal – Theme the Breadcrumb
If you want to override the default breadcrumb HTML output, you can add the following theme_breadcrumb() function in the template.php under your current theme folder.
The following piece of code is an example which add a class for the current breadcrumb. Continue reading Drupal – Theme the Breadcrumb