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 6050029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:38:34+00:00 2026-05-23T07:38:34+00:00

Edit The basic question here is when does the $op parameter get defined as

  • 0

Edit

The basic question here is “when does the $op parameter get defined as ‘search'”?

I am trying to create a custom search in an implementation of hook_search(). I have been looking through the Drupal documentation for the method here: http://api.drupal.org/api/drupal/developer–hooks–core.php/function/hook_search/6

I know the method is running because I can slip a die('killed inside of implementation of hook_search()') into the top of the function and see the output.

In the following code, the script is never killed so that I can see the output search caught inside of my_search(). This leads me to believe that the ‘search’ case of the switch statement is never firing. Does anybody know where I might go from here?

/**
* Implementation of hook_search()
*/
function my_search($op = 'search', $keys = NULL) {
  switch($op)
  {
    case 'search':
        die('search caught inside of my_search()');
        break;
  }
}
  • 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-23T07:38:35+00:00Added an answer on May 23, 2026 at 7:38 am

    First things first.

    Assuming your module is called ‘my’, try to go to URL /search/my/whatever – probably you will see access forbidden page (assuming you do not have anything more in your code besides what you have pasted in your question).

    That’s because you do not return anything when search module calls your hook with $op = ‘name’ (see _search_menu() in search.module). You need to return “a translated name defining the type of items that are searched for with this module (‘content’, ‘users’, …)” – see http://api.drupal.org/api/drupal/developer–hooks–core.php/function/hook_search/6 And access forbidden gone.

    Once this is done, search will call your hook again (actually, there are quite a few calls, you can for example drupal_set_message($op) in your hook to see them all), and one of those calls will be with $op = “search” as well (coming from search_data() in search.module).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic Android question here: I have a main.xml layout that loads
I am here to ask you a basic question about jdom. I am trying
EDIT: This question is now redundant since Twitter no longer supports basic auth. I've
Is there any thing in PHP to create basic scaffold, like in Rails? EDIT:
Sorry for such a basic question regarding lists, but do we have this feature
--EDIT-- I believe this is a valid question that may have multiple answers (as
Basic question here, can I put String variables into a position in a string
I have a really basic question about jquery. However I don't know how to
I realize that this is probably a very basic question, but I have spent
Question As stated, have you any tips to help grok / understand / get-your-head-around

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.