Search the Drupal API quickly using Firefox or Chrome

Chris's picture
Comments (13)
Post a new comment
Chris
26 May, 2011 - 15:06

If you use Firefox or Chrome as your main browser, here's a quick way of searching the Drupal API right from the browser address bar, without having to visit multiple pages to get what you're looking for.

Update: a big thanks to an anonymous commenter for explaining the Chrome equivalent to the Firefox method!

Of course, this works for any site, not just Drupal's API, but this is one of the lesser-known features of these browsers.

Firefox

From the bookmarks menu, choose to Organise Bookmarks. Find where you want to put the bookmark (it doesn't really matter, since you won't be using the bookmarks folder structure to get to it) and add a new bookmark.

Enter any name you like, and in the Location field, enter: http://api.drupal.org/api/search/7/%s

In the keyword field, enter d7.

Once you've saved this, bring up a new tab in Firefox, and type, directly into the URL bar: d7 hook_theme. This will go straight to the API and search it for the Drupal 7 version of hook_theme().

You can set up a second bookmark for Drupal 6 if you need to, using the d6 keyword, or change the keyword to whatever you like. You can even set up searches for other sites. Just remember to replace the search part of the URL with %s. Have fun!

Chrome

In Chrome, head to the spanner icon, then choose Preferences. On the Basics tab, click Manage Search Engines. If you've used the Drupal API before, it's likely that an entry is already there, so just edit it. If not, you can add a new one at the bottom.

Give the left field a label, then type your keyword in the middle field. You could use d7 as your keyword for the Drupal 7 API, for example. In the right field, enter http://api.drupal.org/api/search/7/%s.

Note there's no need to make the search into a default search unless you prefer it that way.

Come out of the preferences, and type, for example, d7 hook_theme into the URL bar. This will go staright to the API and search it for the Drupal 7 version of hook_theme(). Simples!

13

Comments

Anonymous's picture
Anonymous26 May, 2011 - 21:55

This also works in Chrome.

Anonymous's picture
Anonymous27 May, 2011 - 04:33

Could you please publish any instruction how this could be done in Chrome also? Thank you

Drupal Theme Garden's picture
Drupal Theme Garden27 May, 2011 - 09:40

Great trick, thanks!

Anonymous's picture
Anonymous27 May, 2011 - 10:15

In Chrome, it is provided as a search engine by virtue of open search.

Visiting api.drupal.org will automatically install one of the api's, with the keyword "api.drupal.org", this is probably going to be the wrong API version. TO correct, and add a "d7" like keyword, you do the following:
Go to chrome preferences
Select "Manage Search Engines"
The "Other Search Engines" will include an entry for Drupal API Search. You can select it to edit it, and change the keyword. You can also add other sites and keywords.

mcjim's picture
mcjim27 May, 2011 - 10:44

If you use Alfred.app (or another launcher) you can do something similar if switching to your browser to search seems over-arduous: http://www.chrisfree.me/2010/12/use-alfred-search-drupal-api-documentation

yareckon's picture
yareckon27 May, 2011 - 11:39

In FF it's way easier than this. Just right click on any web form, and say "add a keyword for this search". Type in a keyword 'd7' in the box and save. No going into bookmarks, no copying urls, done.

kscheirer's picture
kscheirer27 May, 2011 - 15:11

Nice tip - I repeated this in Chrome, making keywords for d5 d6 d7 and d8

Jeff Geerling's picture
Jeff Geerling27 May, 2011 - 15:21

Very nice. You can do something similar in Safari using the excellent Keywurl addon.

Dustin's picture
Dustin22 September, 2013 - 08:27

There are numerous sites offering you money to click on ads
- but beware of scam. There you can put up ads for writing, proofreading or plenty of other services at $5 a pop.

Carter decided to get out of the peanut business and sold the farm which halved
his overall debt. As much the co-founders go, they both have exceptional track records in the
profession, especially in the online marketing arena.

Also visit my web site ... earn money (sveznalac-forum.com)

Anonymous's picture
Anonymous27 May, 2011 - 15:24

This will save me so much time!!

Thank You Chris

Anonymous's picture
Anonymous27 May, 2011 - 16:34

even easier for FF users, just dl the drupal api add on and search straight from your browser search box,
https://addons.mozilla.org/en-US/firefox/addon/apidrupalorg/ <- drupal 7
https://addons.mozilla.org/en-US/firefox/addon/apidrupal-6x/ <- drupal 6

cool this is you dont need a browser restart,also has the autocomplete function of pervious searchs which are fun.

Anonymous's picture
Anonymous27 May, 2011 - 16:38

just a note. if you want to do the "add keyword to search" in FF you will need to go to this url to have it function properly

http://api.drupal.org/api/search/7
or
http://api.drupal.org/api/search/6

and add the search there otherwize it doesnt work so well.

Venus@Drupal Development's picture
Venus@Drupal De...17 November, 2011 - 12:22

I wasn't aware about this.Thanks for sharing it.Its so useful.

Add new comment