1

When Drupal does a search, and returns no results, an advanced search form is displayed. The form contains a list of content types. There are a couple of content types on our site, but these should be hidden from the user, e.g the end user shouldn't see "contentType", "newType".

I don't want to limit the results, just restrict the user's ability to filter the results using the types.

I've tried looking at the search templates, but couldn't find a reference to the fields.

Any ideas on where I find the correct type or turn off this field?

3

Advanced Search field can be disabled in Permissions settings (it should be disabled by default). enter image description here

If you rather want to leave Advanced Search, but limit to specific content types, you can 1) Use Custom Search module, as advised by @Lance or 2) Dig through modules\search\*.* directory to see which function controls the content type of the Advanced Search options, after which you can use your own module to override the settings.

1

You can use hook_form_alter to change the form to your needs. In your case just go and unset the GUI elements you don't want to show up from the $form array.

If you don't know the form ID just implement an empty hook_form_alter and use dpm() to print the form IDs. You need the devel module and the "Access developer information" permissino to see the output of dpm().

1

Try the Custom Search Module. With this you can specify which role can search which content types and some other nice features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy