• Avail guidance to develop Drupal modules & Drupal themes
  • Share and get review of your code
  • Get Access to free CodeBooks and ThemeBooks
  • Drupal 5, 6 and 7 covered
By adding an Avtar to your profile you can earn 5 points!

Drupal hook: hook_view

The full view of a node including all the information associated with the nodes like author, node posted date, file attached to the node and any other data that are associated by other custom modules is managed by hook_view. The main goal and use of the hook_view is to allow the node modules to add extra information and manage those extra information to display when viewing the node. Nodes can have tease view as well as page view. On teaser view, only some of the information associated with the node is displayed; we can say its an overview of the node. On page view, all the information associated with the node is displayed.

<?php
/**
* Implementation of hook_view
* @param $node
* @param $teaser
* @param $page
* @return unknown_type
* @author Drupal Developer
*/

Drupal hook: hook_block

Blocks are the one of the basic and most fascinating features of Drupal. With block you can display information in the form of block by saving and utilizing the screen area. Here is an example of implementation of hook_block

<?php
/**
* Implementation of hook_block
*
* @param $op
* @param $delta
* @param $edit
* @return $block
* @author Drupal Developer
*/
function browse_info_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[1] = array(
'info' => t("Browse information by category"),
'status' => 1,
'region' => 'content',
'weight' => 0,
);

return $blocks;
case 'configure':
$am__vocabulary = _get_vocabulary();
$am__imagecache = _get_imagecache();

Drupal hook: hook_cron

You've just published a Drupal website and people find it very useful. So, they started signing up with your website and its really very good traffic now. You have planned to implement some features and you want to let know about to all the members of the site. There are two ways: you send e-mails to individuals by using their contact form or implement a system with which you create a node and the site itself sends e-mails. How about sending the e-mails at specific period of time? ohh.. yeah. that's great. Drupal's hook_run makes it happen. Since, there are more features to come, you want to do this every time you have something new to let others know about, you would use hook_cron, which performs specific tasks assigned to it periodically.

Share your Drupal codes

We are pleased to announce a successful implementation of CodeBook, a feature which lets you share your Drupal codes and shows your Drupal skill to the world. By creating CodeBooks, you can showcase your Drupal Development skills by referring the CodeBooks to your potential clients as well as recruiters. This is all about helping the community in learning the Drupal in an easier way. So, Join the movement!

We, the people of India...

Happy Republic Day!

We, the people of India, are celebrating 60 years of becoming sovereign. By looking back, we are proud of our progress we achieved after becoming independent. British rule is an old story. We love to talk about the progress and the honor India and Indians, all over the world, have earned. Unstable and Untrustworthy neighbors have tried to disturb our life by fighting proxy wars, but we are stand still like Himalayas. We, the people of India, proud to be Indians!!

Jai Hind!!

Video Chat! have you tried it?

Its our pleasure to announce the inclusion of Video chat. Now, you can chat using video on Drupal Developer. Pretty nice interface and very good quality video. Making it more easy for Drupal developers to communicate and act faster. Try it today and drop a feedback. We are hearing you.

Drupal hook: hook_install

hook_install() creates tables in the database for the module to which its associated. hook_install not just restricted creating tables but it also creates vocabularies, terms in the vocabularies and sets variables to be used by modules. The hook_install set ups the basic requirement for a module to function properly. Not all the modules require to implement hook_install but which saves data to own tables and for providing extra features for which there are no tables or fields exists from where information can be fetched.

  • Drupal 5: Table definition and all other required set up for the module
  • Drupal 6, 7: drupal_install_schema('[hook]')

Here is an example of hook_install()

<?php
/**
* Implementation of hook_install
*

Drupal Developer on your mobile phone

Now you can stay connected to Drupal Developer as you go and can access the free Codes and information about Drupal.
Drupal Developer is now available on mobile phone. You can do every thing on Drupal Developer with your mobile phone as you usually do on computer. Try it now let us know what do you think about this new feature.

Drupal module hooks: install file

When Developing a custom module for Drupal, we need to use Drupal APIs and we need to make use of Drupal hooks. There are many Drupal hooks available and different hooks go in different files.

In this section we will learn about all those required hooks which should be written when developing a custom Drupal module.

First we will look at the hooks which are written in .install file.

I'd like to make a note here that don't mistaken the .module as the Drupal module. A Drupal module is consist of one or more .module file, one or more .info file and optionally, one or more .install file.

So, first we look at the hooks in .install file.

hook_install()

  • Drupal 5.x - Table structure and other items like vocabulary and its terms to be used by the module.
Syndicate content

Recent comments

toolbar powered by www.mit3xxx.de