[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/module_builder/templates/ -> hooks.template (source)

   1  
   2  /**
   3   * @file
   4   * Defines default templates for hook functions.
   5   */
   6   
   7  == START hook_help ==
   8    /* INFO:
   9     * The help hook is for displaying helpful messages at the top of pages indicated
  10     * by $section to further explain how they work. Adding certain "keywords" to the end of 
  11     * a given path (like admin/modules#description) will cause this text to display elsewhere
  12     * in the page as well (in this case, in the description section for the given module).
  13     */
  14    switch ($path) {
  15      case 'admin/help#%module':
  16        return t("%help");
  17      // OPTIONAL: Add additional cases for other paths that should display help text.
  18    }
  19  == END ==
  20  
  21  == START hook_menu == 
  22    // This is the minimum information you can provide for a menu item.
  23    $items['TODO: Enter path'] = array(
  24      'title' => 'TODO: Enter menu item title',
  25      'page callback' => 'TODO: Enter callback function',
  26      'access arguments' => array('TODO: Enter user permissions'),
  27    );
  28    // more complex menu item
  29    $items['TODO: Enter path'] = array(
  30      'title' => 'TODO: Enter menu item title',
  31      'description' => 'TODO: Enter description',
  32      'page callback' => 'TODO: Enter callback function',
  33      'page arguments' => '', // An array of arguments to pass to the page callback function. Integer values pass the corresponding URL component.
  34      'access callback' => '', // defaults to user_access()
  35      'access arguments' => array('TODO: Enter user permissions'),
  36      'weight' => 0,
  37      'type' => MENU_NORMAL_ITEM, // One of MENU_NORMAL_ITEM / MENU_CALLBACK / MENU_SUGGESTED_ITEM / MENU_LOCAL_TASK / MENU_DEFAULT_LOCAL_TASK
  38      'menu_name' => '', // Menu to place this item in.
  39      'title callback' => '', // Function to generate the title, defaults to t(). 
  40      'title arguments' => '', // Arguments to send to t() or your custom callback. 
  41    );
  42    // OPTIONAL: Fill in additional static menu items
  43  
  44    return $items;
  45  == END ==
  46  
  47  == START hook_perm ==
  48    return array('TODO: Insert permission name');
  49  == END ==
  50  
  51  == START hook_block ==
  52    switch ($op) {
  53  
  54      case 'list':
  55        $blocks[0]['info'] = t('Block 1');
  56        $blocks[1]['info'] = t('Block 2');
  57        // OPTIONAL: Add additional block descriptions here, if required.
  58        return $blocks;
  59  
  60      case 'configure':
  61        // OPTIONAL: Enter form elements to add to block configuration screen, if required.    
  62        if ($delta == 0 && user_access('administer module')) {
  63          $form['module_block_1'] = array();
  64        }
  65        if ($delta == 1 && user_access('administer module')) {
  66          $form['module_block_2'] = array();
  67        }
  68        return $form;
  69  
  70      case 'save':
  71        // OPTIONAL: Add code to trigger when block configuration is saved, if required.
  72        if ($delta == 0) {
  73          variable_set('module_block_setting_1', $edit['module_block_1']);
  74        }
  75        if ($delta == 1) {
  76          variable_set('module_block_setting_2', $edit['module_block_2']);
  77        }
  78        break;
  79  
  80      case 'view':
  81        if ($delta == 0) {
  82          $block['subject'] = t('Block 1 title');
  83          $block['content'] = t('Block 1 content');
  84        }
  85        if ($delta == 1) {
  86          $block['subject'] = t('Block 2 title');
  87          $block['content'] = t('Block 2 content');
  88        }
  89        // OPTIONAL: Enter additional cases for each additional block, if defined.
  90  
  91        return $block;
  92    }    
  93  == END ==
  94  
  95  == START hook_link ==
  96    $links = array();
  97    
  98    // TODO: Perform logic to determine when link should appear
  99    $links['%module_KEY1'] = array( // a regular link
 100      'title' => t('TODO: Fill in link title'),
 101      'href' => 'TODO: Fill in link path',
 102      'attributes' => array('title' => t('TODO: Fill in link title attribute.')),  
 103    );
 104    $links['%module_KEY1'] = array( // a fake link that's just text
 105      'title' => t('TODO: Fill in link title'),
 106      'attributes' => array('title' => t('TODO: Fill in link title attribute.')),  
 107    );
 108    $links['%module_KEY1'] = array( // a link that's we're sending as HTML
 109      'title' => t('TODO: Fill in link HTML'),
 110      'html' => TRUE,
 111    );
 112    // OPTIONAL: Add additional links
 113    
 114    return $links;
 115  == END ==
 116  
 117  == START hook_nodeapi ==
 118    switch ($op) {
 119      case 'alter':
 120        // OPTIONAL: the $node->content array has been rendered, so the node body or
 121        // teaser is filtered and now contains HTML. This op should only be used when
 122        // text substitution, filtering, or other raw text operations are necessary.
 123        break;
 124      case 'delete':
 125        // OPTIONAL: The node is being deleted.
 126        break;
 127      case 'delete revision':
 128        // OPTIONAL: The revision of the node is deleted. You can delete data
 129        // associated with that revision.
 130        break;
 131      case 'insert':
 132        // OPTIONAL: The node is being created (inserted in the database).
 133        break;
 134      case 'load':
 135        // OPTIONAL: The node is about to be loaded from the database. This hook
 136        // can be used to load additional data at this time.
 137        break;
 138      case 'prepare':
 139        // OPTIONAL: The node is about to be shown on the add/edit form.
 140        break;
 141      case 'prepare translation':
 142        // OPTIONAL: The node is being cloned for translation. Load
 143        // additional data or copy values from $node->translation_source.
 144        break;
 145      case 'print':
 146        // OPTIONAL: Prepare a node view for printing. Used for printer-friendly
 147        // view in book_module
 148        break;
 149      case 'rss item':
 150        // OPTIONAL: An RSS feed is generated. The module can return properties
 151        // to be added to the RSS item generated for this node. See comment_nodeapi()
 152        // and upload_nodeapi() for examples. The $node passed can also be modified
 153        // to add or remove contents to the feed item.
 154        break;
 155      case 'search result':
 156        // OPTIONAL: The node is displayed as a search result. If you
 157        // want to display extra information with the result, return it.
 158        break;
 159      case 'presave':
 160        // OPTIONAL: The node passed validation and is about to be saved. Modules may
 161        //  use this to make changes to the node before it is saved to the database.
 162        break;
 163      case 'update':
 164        // OPTIONAL: The node is being updated.
 165        break;
 166      case 'update index':
 167        // OPTIONAL: The node is being indexed. If you want additional
 168        // information to be indexed which is not already visible through
 169        // nodeapi "view", then you should return it here.
 170        break;
 171      case 'validate':
 172        // OPTIONAL: The user has just finished editing the node and is
 173        // trying to preview or submit it. This hook can be used to check
 174        // the node data. Errors should be set with form_set_error().
 175        break;
 176      case 'view':
 177        // OPTIONAL: The node content is being assembled before rendering. The module
 178        // may add elements $node->content prior to rendering. This hook will be
 179        // called after hook_view().  The format of $node->content is the same as
 180        // used by Forms API.
 181        break;
 182    }
 183  == END ==
 184  
 185  == START hook_elements ==
 186    $type['example'] = array('#property' => t('TODO: Fill in appropriate properties and values for element type.'));
 187    // OPTIONAL: Define additional element types.
 188    return $type;
 189  == END ==
 190  
 191  == START hook_filter ==
 192    switch ($op) {
 193      case 'list':
 194        return array(t('TODO: Fill in name of filter.'));
 195  
 196      case 'description':
 197        return t('TODO: Fill in filter description.');
 198  
 199      case 'no cache':
 200        // TODO: This case can be removed for most filters, but returning TRUE is useful for development.
 201        return FALSE;
 202  
 203      case 'prepare':
 204        return $text;
 205  
 206      case 'process':
 207        // TODO: Code function call for filter to run text through.
 208        return;
 209  
 210      case 'settings':
 211        // OPTIONAL: Add additional settings for filter.
 212        return;
 213    }
 214  == END ==
 215  
 216  == START hook_filter_tips ==
 217    // OPTIONAL: If more than one filter was defined in hook_filter, perform switch on $delta
 218    switch ($long) {
 219      case FALSE:
 220        return t("TODO: Enter the filter's short-hand description");
 221      case TRUE:
 222        return t("TODO: Enter filter's full description");
 223    }
 224  == END ==
 225  
 226  == START hook_theme ==
 227    return array(
 228      'my_simple_theme_function' => array(
 229        'arguments' => array('arg1' => NULL, 'arg2' => 0, 'arg3' => FALSE),
 230      ),
 231    );
 232  == END ==
 233  
 234  == START hook_views_api ==
 235    return array(
 236      'api' => 2,
 237      'path' => drupal_get_path('module', '%module'),
 238    );
 239  == END ==
 240  
 241  == START hook_views_handlers ==
 242    return array(
 243      'info' => array(
 244        'path' => drupal_get_path('module', '%module'),
 245      ),
 246      'handlers' => array(
 247        '%module_handler_TYPE_TABLE_FIELDNAME' => array(
 248          'parent' => 'views_handler_field_term_node_tid',
 249        ),
 250      ),
 251    );
 252  == END ==
 253  
 254  


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7