Drupal 6 Core Hooks Cheat Sheet

  • Uploaded by: Poakpong
  • 0
  • 0
  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Drupal 6 Core Hooks Cheat Sheet as PDF for free.

More details

  • Words: 689
  • Pages: 2
6.x Core Hooks Cheat Sheet, valid as of January 20th, 2008

A

Hook

Implementation in Core

hook_access($op, $node, $account)

modules/poll/poll.module

Define access restrictions.

B

hook_block($op = 'list', $delta = 0, $edit = array())

modules/comment/comment.module

Declare a block or set of blocks. N/A

hook_boot() Perform setup tasks. See also, hook_init.

C

hook_comment($a1, $op)

modules/user/user.module

Act on comments. modules/search/search.module

hook_cron() Perform periodic actions.

D

hook_db_rewrite_sql($query, $primary_table, $primary_field, $args)

modules/node/node.module

Rewrite database queries, usually for access control.

hook_delete(&$node)

modules/poll/poll.module

Respond to node deletion. N/A

hook_disable() Perform necessary actions before module is disabled.

E

hook_elements()

modules/system/system.module

Allows modules to declare their own form element types and specify their default values. modules/menu/menu.module

hook_enable() Perform necessary actions after module is enabled.

hook_exit($destination = NULL)

modules/statistics/statistics.module

Perform cleanup tasks.

F

hook_file_download($file)

modules/user/user.module

Allow file downloads.

hook_filter($op, $delta = 0, $format = -1, $text = '')

modules/filter/filter.module

Define content filters.

hook_filter_tips($delta, $format, $long = false)

modules/filter/filter.module

Provide tips for using filters.

hook_footer($main = 0)

N/A

Insert closing HTML.

hook_form(&$node, &$param)

modules/search/search.module

Display a node editing form. modules/search/search.module

hook_forms() Map form_ids to builder functions.

hook_form_alter(&$form, $form_state, $form_id)

modules/locale/locale.module

Perform alterations before a form is rendered.

H

hook_help($path, $arg)

modules/openid/openid.module,

Provide online user help.

I

modules/forum/forum.module

hook_init() Perform setup tasks. See also, hook_boot.

hook_insert($node)

modules/poll/poll.module

Respond to node insertion. N/A

hook_install() Install the current version of the database schema, and any other setup tasks.

L

hook_link($type, $object, $teaser = FALSE)

modules/node/node.module

Define internal Drupal links.

hook_link_alter(&$links, $node)

modules/forum/forum.module

Perform alterations before links on a node are rendered. One popular use of this hook is to add/delete links from other modules.

hook_load($node)

modules/path/path.module

Load node-type-specific information.

M

hook_mail($key, &$message, $params)

modules/update/update.module

Prepare a message based on parameters. See drupal_mail for more.

hook_mail_alter(&$message)

N/A

Alter any aspect of the emails sent by Drupal modules/path/path.module

hook_menu() Define menu items and page callbacks.

hook_menu_alter(&$callbacks)

modules/upload/upload.module

Alter the data being saved to the {menu_router} table after hook_menu is invoked.

hook_menu_link_alter(&$item, $menu)

modules/forum/forum.module

Alter the data being saved to the {menu_links} table by menu_link_save().

Licensed under Creative Commons Attribution-Share Alike 2.0 By kourge. http://kourge.net/

6.x Core Hooks Cheat Sheet, valid as of January 20th, 2008

N

Hook

Implementation in Core

hook_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL)

modules/path/path.module

Act on nodes defined by other modules.

hook_node_access_records($node)

N/A

Set permissions for a node to be written to the database.

hook_node_grants($account, $op)

N/A

Inform the node access system what permissions the user has.

hook_node_info() Define module-provided node types.

hook_node_operations()

modules/poll/poll.module modules/blog/blog.module modules/forum/forum.module modules/node/node.admin.inc

Add mass node operations.

hook_node_type($op, $info)

modules/taxonomy/taxonomy.module

Act on node type changes.

P

modules/search/search.module

hook_perm() Define user permissions.

hook_ping($name = '', $url = '')

modules/ping/ping.module

Ping another server.

hook_prepare(&$node)

modules/node/node.module

This is a hook used by node modules. It is called after load but before the node is shown on the add/edit form.

hook_profile_alter(&$fields, $account)

N/A

Perform alterations profile items before they are rendered. You may omit/add/re-sort/recategorize, etc.

R

hook_requirements($phase)

modules/update/update.module

Check installation requirements and do status reporting.

S

N/A

hook_schema() Define the current version of the database schema.

hook_search($op = 'search', $keys = null)

modules/user/user.module

Define a custom search routine.

hook_search_item($item)

N/A

Format a search result.

hook_search_preprocess($text)

N/A

Preprocess text for the search index.

hook_submit(&$node)

modules/node/node.module

This is a hook used by node modules. It is called after validation has succeeded and before insert/update. It is used to for actions which must happen only if the node is to be saved.

T

hook_taxonomy($op, $type, $array = NULL)

modules/forum/forum.module

Act on taxonomy changes. modules/search/search.module

hook_theme() Register a module’s (or theme’s) theme implementations.

U

hook_uninstall()

N/A

Remove any tables or variables that the module sets.

hook_update($node)

modules/poll/poll.module

Respond to node updating.

hook_update_index()

modules/node/node.module

Update Drupal’s full-text index for this module.

hook_update_N()

N/A

Perform a single update. For each patch which requires a database change add a new hook_update_N() which will be called by update.php.

hook_user($op, &$edit, &$account, $category = NULL)

modules/dblog/dblog.module

Act on user account actions.

hook_user_operations()

modules/user/user.module

Add mass user operations.

V

hook_validate($node)

modules/poll/poll.module

Verify a node editing form.

hook_view($node, $teaser = FALSE, $page = FALSE)

modules/poll/poll.module

Display a node.

W

hook_watchdog($log_msg)

modules/dblog/dblog.module

Log an event message

X

modules/blogapi/blogapi.module

hook_xmlrpc() Register XML-RPC callbacks.

Licensed under Creative Commons Attribution-Share Alike 2.0 By kourge. http://kourge.net/

Related Documents

Cheat Sheet
August 2019 52
Drupal
June 2020 12
The Drupal 6 Manual
June 2020 2
Drupal
December 2019 23

More Documents from ""