• 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

Userpoints Meter

0 Points /1000 Points

Custom hook

I want to create custom hook which can be used by different modules. What are the steps and best possible way to create custom hooks?

5
Your rating: None Average: 5 (3 votes)
DrupalD's picture

To create/offer custom Drupal hook, you must implement in a ways such that calling the hook with module_invoke or module_invoke_all does not make any conflicts with other module hooks. The name of the hook should be unique and it should offer all/specific feature in such a general way that it doesn't require any type of adjustments with code. All the configuration must go on admin pages and should store those configurations in a separate table or any existing tables create by Drupal or modules on which your modules depends. The hook should be easy to implment by other modules and it should not be much complex to implement. When you create custom hooks, your module(s) act(s) as API provider.

Let me know if this can help you. Feel free to drop in a line at any time.

Regards.

[url=http://twitter.com/DrupalD][i]Drupa Developer - A Comprehensive Guild to Drupal Developersl[/i][/url]

beautifulmind's picture

Thanks for your information. That will do.

Regards

Syndicate content

Recent comments