List of useful hooks and functions in Drupal 7. You can find here something new or just bookmark it for your reference.
Source code viewer
// Includes another module file, so you can use functions that are in that file. module_load_include($type, $module, $name = NULL); // Use same window as dpm called krumo, to show arrays in message log. watchdog('debug', kprint_r($var, TRUE, NULL)); // Hook form alter just for reference, I really need this a lot. /** * Implements hook_form_alter(). */ function HOOK_form_alter(&$form, &$form_state, $form_id) { } // Use instead of hook_init: browse-tutorials.com/snippet/use-hookpagebuild-instead-hookinit-add-css-or-js-every-page /** * Implements hook_page_build(). */ function hook_page_build(&$page) { } // More views hooks: api.drupal.org/api/views/views.api.php/group/views_hooks/7 /** * Implements hook_views_query_alter(). */ function HOOK_views_query_alter(&$view, &$query) { } // Returns snippets from a piece of text, with certain keywords highlighted. Used for formatting search results. search_excerpt($keys, $text) // Performs HTTP requests. This is a flexible and powerful HTTP client implementation. Correctly handles GET, POST, PUT or any other HTTP requests. // Static cache. function foo() { $cache = &drupal_static(__FUNCTION__); // ... } return $cache; } // "Permanent" cache. function foo() { $cache = &drupal_static(__FUNCTION__); if ($cache = cache_get(__FUNCTION__ . '_data')) { $cache = $cache->data; } else { // ... cache_set(__FUNCTION__ . '_data', $cache, 'cache'); } } return $cache; }Programming Language: PHP