/** * @file * Defines default templates for hook functions. */ == START hook_help == /* INFO: * The help hook is for displaying helpful messages at the top of pages indicated * by $section to further explain how they work. Adding certain "keywords" to the end of * a given path (like admin/modules#description) will cause this text to display elsewhere * in the page as well (in this case, in the description section for the given module). */ switch ($path) { case 'admin/help#%module': return t("%help"); // OPTIONAL: Add additional cases for other paths that should display help text. } == END == == START hook_menu == // This is the minimum information you can provide for a menu item. $items['TODO: Enter path'] = array( 'title' => 'TODO: Enter menu item title', 'page callback' => 'TODO: Enter callback function', 'access arguments' => array('TODO: Enter user permissions'), ); // more complex menu item $items['TODO: Enter path'] = array( 'title' => 'TODO: Enter menu item title', 'description' => 'TODO: Enter description', 'page callback' => 'TODO: Enter callback function', 'page arguments' => '', // An array of arguments to pass to the page callback function. Integer values pass the corresponding URL component. 'access callback' => '', // defaults to user_access() 'access arguments' => array('TODO: Enter user permissions'), 'weight' => 0, 'type' => MENU_NORMAL_ITEM, // One of MENU_NORMAL_ITEM / MENU_CALLBACK / MENU_SUGGESTED_ITEM / MENU_LOCAL_TASK / MENU_DEFAULT_LOCAL_TASK 'menu_name' => '', // Menu to place this item in. 'title callback' => '', // Function to generate the title, defaults to t(). 'title arguments' => '', // Arguments to send to t() or your custom callback. ); // OPTIONAL: Fill in additional static menu items return $items; == END == == START hook_perm == return array('TODO: Insert permission name'); == END == == START hook_block == switch ($op) { case 'list': $blocks[0]['info'] = t('Block 1'); $blocks[1]['info'] = t('Block 2'); // OPTIONAL: Add additional block descriptions here, if required. return $blocks; case 'configure': // OPTIONAL: Enter form elements to add to block configuration screen, if required. if ($delta == 0 && user_access('administer module')) { $form['module_block_1'] = array(); } if ($delta == 1 && user_access('administer module')) { $form['module_block_2'] = array(); } return $form; case 'save': // OPTIONAL: Add code to trigger when block configuration is saved, if required. if ($delta == 0) { variable_set('module_block_setting_1', $edit['module_block_1']); } if ($delta == 1) { variable_set('module_block_setting_2', $edit['module_block_2']); } break; case 'view': if ($delta == 0) { $block['subject'] = t('Block 1 title'); $block['content'] = t('Block 1 content'); } if ($delta == 1) { $block['subject'] = t('Block 2 title'); $block['content'] = t('Block 2 content'); } // OPTIONAL: Enter additional cases for each additional block, if defined. return $block; } == END == == START hook_link == $links = array(); // TODO: Perform logic to determine when link should appear $links['%module_KEY1'] = array( // a regular link 'title' => t('TODO: Fill in link title'), 'href' => 'TODO: Fill in link path', 'attributes' => array('title' => t('TODO: Fill in link title attribute.')), ); $links['%module_KEY1'] = array( // a fake link that's just text 'title' => t('TODO: Fill in link title'), 'attributes' => array('title' => t('TODO: Fill in link title attribute.')), ); $links['%module_KEY1'] = array( // a link that's we're sending as HTML 'title' => t('TODO: Fill in link HTML'), 'html' => TRUE, ); // OPTIONAL: Add additional links return $links; == END == == START hook_nodeapi == switch ($op) { case 'alter': // OPTIONAL: the $node->content array has been rendered, so the node body or // teaser is filtered and now contains HTML. This op should only be used when // text substitution, filtering, or other raw text operations are necessary. break; case 'delete': // OPTIONAL: The node is being deleted. break; case 'delete revision': // OPTIONAL: The revision of the node is deleted. You can delete data // associated with that revision. break; case 'insert': // OPTIONAL: The node is being created (inserted in the database). break; case 'load': // OPTIONAL: The node is about to be loaded from the database. This hook // can be used to load additional data at this time. break; case 'prepare': // OPTIONAL: The node is about to be shown on the add/edit form. break; case 'prepare translation': // OPTIONAL: The node is being cloned for translation. Load // additional data or copy values from $node->translation_source. break; case 'print': // OPTIONAL: Prepare a node view for printing. Used for printer-friendly // view in book_module break; case 'rss item': // OPTIONAL: An RSS feed is generated. The module can return properties // to be added to the RSS item generated for this node. See comment_nodeapi() // and upload_nodeapi() for examples. The $node passed can also be modified // to add or remove contents to the feed item. break; case 'search result': // OPTIONAL: The node is displayed as a search result. If you // want to display extra information with the result, return it. break; case 'presave': // OPTIONAL: The node passed validation and is about to be saved. Modules may // use this to make changes to the node before it is saved to the database. break; case 'update': // OPTIONAL: The node is being updated. break; case 'update index': // OPTIONAL: The node is being indexed. If you want additional // information to be indexed which is not already visible through // nodeapi "view", then you should return it here. break; case 'validate': // OPTIONAL: The user has just finished editing the node and is // trying to preview or submit it. This hook can be used to check // the node data. Errors should be set with form_set_error(). break; case 'view': // OPTIONAL: The node content is being assembled before rendering. The module // may add elements $node->content prior to rendering. This hook will be // called after hook_view(). The format of $node->content is the same as // used by Forms API. break; } == END == == START hook_elements == $type['example'] = array('#property' => t('TODO: Fill in appropriate properties and values for element type.')); // OPTIONAL: Define additional element types. return $type; == END == == START hook_filter == switch ($op) { case 'list': return array(t('TODO: Fill in name of filter.')); case 'description': return t('TODO: Fill in filter description.'); case 'no cache': // TODO: This case can be removed for most filters, but returning TRUE is useful for development. return FALSE; case 'prepare': return $text; case 'process': // TODO: Code function call for filter to run text through. return; case 'settings': // OPTIONAL: Add additional settings for filter. return; } == END == == START hook_filter_tips == // OPTIONAL: If more than one filter was defined in hook_filter, perform switch on $delta switch ($long) { case FALSE: return t("TODO: Enter the filter's short-hand description"); case TRUE: return t("TODO: Enter filter's full description"); } == END == == START hook_theme == return array( 'my_simple_theme_function' => array( 'arguments' => array('arg1' => NULL, 'arg2' => 0, 'arg3' => FALSE), ), ); == END == == START hook_views_api == return array( 'api' => 2, 'path' => drupal_get_path('module', '%module'), ); == END == == START hook_views_handlers == return array( 'info' => array( 'path' => drupal_get_path('module', '%module'), ), 'handlers' => array( '%module_handler_TYPE_TABLE_FIELDNAME' => array( 'parent' => 'views_handler_field_term_node_tid', ), ), ); == END ==