Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3969070
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:55:10+00:00 2026-05-20T03:55:10+00:00

Is it possible to create your own hook in a Drupal module for other

  • 0

Is it possible to create your own hook in a Drupal module for other Drupal modules to consume? If not, is there a mechanism in Drupal for third party developers to provide hooks? If everything’s been a no so far, where in the core are the list of hooks implemented?

As I understand things, Drupal modules work on a event like system called hooks. When you create a new module, you create functions that implement a hook. For example, there’s a hook_delete hook. If you implement a function in your module

function mymodule_delete($node)
{
}

this function will be called whenever a node is deleted.

What I want to know is, is there a way or me, as a third party module developer, to create my own hooks. Say, something like hook_alanskickbutthook so that other module developers could subscribe to this hook.

If this is possible, how do you do it? I’ve looked around the official docs and haven’t found much there, and I still get a little dizzy when I start poking around the Drupal source code (I understand recursion, but don’t spend enough time thinking about recursive problems). Full solutions are welcome, but I’m happy to just be pointed in the right direction.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T03:55:11+00:00Added an answer on May 20, 2026 at 3:55 am

    Module_invoke_all() is your ticket to creating your own hooks:

    see the API:

    http://api.drupal.org/api/drupal/includes–module.inc/function/module_invoke_all

    and then look at this great writeup:

    http://web.archive.org/web/20101227170201/http://himerus.com/blog/himerus/creating-hooks-your-drupal-modules

    (edit: was at http://himerus.com/blog/himerus/creating-hooks-your-drupal-modules but this is now gone)

    Once you’ve made your hook, it can be called in another module using:

    /**
     * Implementation of hook_myhookname()
     */
    
    function THISMODULENAME_myhookname(args){
      //do stuff
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain why it's not possible to create your own view controller hierarchies
Is it possible to create your own widgets in XAML?
Is it possible to create your own custom, I believe the term is 'method'?
Is it possible to create a trigger that will not be in a transaction?
Is it possible to create LIGHTWEIGHT transactions using TransactionScope() with SQL2000? Or if not,
I have a question about tags for UIViews. Is it possible to create your
How do you create your own custom component for vb.net 2008? I want it
Is it possible to create a hyperlink on your web page that can play
Is it advisable to create your own Activity stack (which contains only the activity
Is it possible to create federated Subversion servers? As in one server at location

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.