没想到啊

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  6 随笔 :: 379 文章 :: 97 评论 :: 24万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

1、使用这个XML文件

复制代码
Drupal
<?xml version="1.0" encoding="UTF-8"?><templates><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook access - Define access restrictions." enabled="true" name="hook_access">/**
 * Implementation of hook_access().
 *
 * @param $$op Operation to be performed.
 * @param $$node The node on which the operation is to be performed, or, if it does not yet exist, the type of node to be created. 
 * @param $$account A user object representing the user for whom the operation is to be performed.
 * @return TRUE if the operation is to be allowed; FALSE if the operation is to be denied; NULL to not override the settings in the node_access table, or access control modules.
 */
function ${module_name}_access($$op, $$node, $$account) {

  switch ($$op) {
    case "create" :
      return;
    case "delete" :
      return;
    case "update" :
      return;
    case "view" :
      return;
  }
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook action info - Declare information about one or more Drupal actions." enabled="true" name="hook_action_info">/**
 * Implementation of hook_action_info().
 */
function ${module_name}_action_info() {
  return array(
    '${module_name}_${cursor}' =&gt; array(
      'description' =&gt; t(''),
      'type' =&gt; '',
      'configurable' =&gt; ,
      'hooks' =&gt; array(
        '' =&gt; array(),
      )
    )
  );
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook action info alter - Alter the actions declared by another module." enabled="true" name="hook_action_info_alter">/**
 * Implementation of hook_action_info_alter().
 *
 * @param $$actions Array of action information.
 */
function ${module_name}_action_info_alter(&amp;$$actions) {
  $$actions['${cursor}'];
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook actions delete - Execute code after an action is deleted." enabled="true" name="hook_actions_delete">/**
 * Implementation of hook_actions_delete().
 *
 * @param $$aid The action ID.
 */
function ${module_name}_actions_delete($$aid) {
  ${cursor}db_query("DELETE FROM {actions_assignments} WHERE aid = '%s'", $$aid);
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook block - Declare a block or set of blocks." enabled="true" name="hook_block">/**
 * Implementation of hook_block().
 *
 * @param $$op What kind of information to retrieve about the block. Possible values: list, configure, save, view.
 * @param $$delta Which block to return.
 * @param $$edit Data from a configuration form, if submitted.
 */
function ${module_name}_block($$op = 'list', $$delta = 0, $$edit = array()) {
  switch ($$op) {
    case 'list':
      $$blocks[0] = array(
        'info' =&gt; t('${block_title}'),
      ); 
      return $$blocks;
    case 'configure':
      $$form = array();
      
      return $$form;
    case 'save':
      return;
    case 'view': default:
      switch ($$delta) {
        case 0:
          $$block['subject'] = t('${block_subject}');
          $$block['content'] = t('${block_description}');
          break;
      }
      return $$block;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook boot - Perform setup tasks." enabled="true" name="hook_boot">/**
 * Implementation of hook_boot().
 */
function ${module_name}_boot() {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook comment - Act on comments." enabled="true" name="hook_comment">/**
 * Implementation of hook_comment().
 */
function ${module_name}_comment(&amp;$$a1, $$op) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook cron - Perform periodic actions." enabled="true" name="hook_cron">/**
 * Implementation of hook_cron().
 */
function ${module_name}_cron() {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook_db_rewrite_sql - Rewrite database queries, usually for access control." enabled="true" name="hook_db_rewrite_sql">/**
 * Implementation of hook_db_rewrite_sql().
 */
function ${module_name}_db_rewrite_sql($$query, $$primary_table, $$primary_field, $$args) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook delete - Respond to node deletion." enabled="true" name="hook_delete">/**
 * Implementation of hook_delete().
 *
 * @param $$node The node being deleted.
 */
function ${module_name}_delete(&amp;$$node) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook disable - Perform necessary actions before module is disabled." enabled="true" name="hook_disable">/**
 * Implementation of hook_disable().
 */
function ${module_name}_disable() {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook elements - Allows modules to declare their own Forms API element types and specify their default values." enabled="true" name="hook_elements">/**
 * Implementation of hook_elements().
 */
function ${module_name}_elements() {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook enable - Perform necessary actions after module is enabled." enabled="true" name="hook_enable">/**
 * Implementation of hook_enable().
 */
function ${module_name}_enable() {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook exit - Perform cleanup tasks. This hook is run at the end of each page request." enabled="true" name="hook_exit">/**
 * Implementation of hook_exit().
 */
function ${module_name}_exit() {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook file download - Control access to private file downloads and specify HTTP headers." enabled="true" name="hook_file_download">/**
 * Implementation of hook_file_download().
 *
 * @param $$filepath String of the file's path.
 */
function ${module_name}_file_download($$filepath) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook filter - Define content filters." enabled="true" name="hook_filter">/**
 * Implementation of hook_filter().
 */
function ${module_name}_filter($$op, $$delta = 0, $$format = -1, $$text = '', $$cache_id = 0) {
  switch ($$op) {
    case 'list':
      return array(${cursor});

    case 'description':
      return t('');

    case 'prepare':
      return $$text;

    case "process":
      return $$text;

    default:
      return $$text;
  }
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook filter tips - Provide tips for using filters." enabled="true" name="hook_filter_tips">/**
 * Implementation of hook_filter_tips().
 *
 * @param $$delta Which of this module's filters to use. Modules which only implement one filter can ignore this parameter.
 * @param $$format Which format we are providing tips for.
 * @param $$long If set to true, long tips are requested, otherwise short tips are needed.
 * @return string
 */
function ${module_name}_filter_tips($$delta, $$format, $$long = FALSE) {
  return t('${cursor}');
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook flush caches - Add a list of cache tables to be cleared." enabled="true" name="hook_flush_caches">/**
 * Implementation of hook_flush_caches().
 *
 * @return An array of cache table names.
 */
function ${module_name}_flush_caches() {
  return array('${cursor}');
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook footer - Insert closing HTML." enabled="true" name="hook_footer">/**
 * Implementation of hook_footer().
 *
 * @param $$main Whether the current page is the front page of the site.
 * @return The HTML to be inserted.
 */
function ${module_name}_footer($$main = 0) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook form - Display a node editing form." enabled="true" name="hook_form">/**
 * Implementation of hook_form().
 *
 * @param &amp;$$node The node being added or edited.
 * @param $$form_state The form state array.
 * @return An array containing the form elements to be displayed in the node edit form.
 */
function ${module_name}_form(&amp;$$node, $$form_state) {
  $$form = array();
  
  $$form['${cursor}'] = array(
    '#type' =&gt; ''
  );
  
  return $$form;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook form alter - Perform alterations before a form is rendered." enabled="true" name="hook_form_alter">/**
 * Implementation of hook_form_alter().
 */
function ${module_name}_form_alter(&amp;$$form, $$form_state, $$form_id) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 form FORM ID alter - Provide a form-specific alteration." enabled="true" name="hook_form_FORM_ID_alter">/**
 * Implementation of hook_form_FORM_ID_alter().
 */
function ${module_name}_form_${form_id}_alter(&amp;$$form, &amp;$$form_state) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook form item" enabled="true" name="hook_form_item">$$form[${form_item}] = array(
  '#type' =&gt; '${form_item_type}',
  '#title' =&gt; t('${form_item_title}'),
  '#description' =&gt; t('${form_item_description}'),
  '#attributes' =&gt; array(),
  '#required' =&gt; FALSE,
  '#tree' =&gt; FALSE,
  '#parents' =&gt; array(),
);</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook form validate" enabled="true" name="hook_form_validate">/**
 * Validate ${module_form} form
 *
 * @param $$form form to validate
 * @param $$form_state A keyed array containing the current state of the form.
 */
function ${module_form}_validate($$form, &amp;$$form_state) {
  if (${form_field_test}) {
    form_set_error('${form_field_id}', t('${form_field_error}'));
  }
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook forms - Map form_ids to builder functions." enabled="true" name="hook_forms">/**
 * Implementation of hook_forms().
 */
function ${module_name}_forms() {
  $$forms['${cursor}'] = array(
    'callback' =&gt; ''
  );
  return $$forms;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook help - Provide online user help." enabled="true" name="hook_help">/**
 * Implementation of hook_help().
 *
 * @param $$path A Drupal menu router path the help is being requested.
 * @param $$arg An array that corresponds to the return of the arg() function.
 * @return A localized string containing the help text.
 */
function ${module_name}_help($$path, $$arg) {
  $$output = '';
  switch ($$path) {
    case "admin/help#${module_name}":
      $$output = '';
      break;
  }
  return $$output;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook hook info - Expose a list of triggers (events) that your module is allowing users to assign actions to." enabled="true" name="hook_hook_info">/**
 * Implementation of hook_hook_info().
 */
function ${module_name}_hook_info() {
  return array(
    '${cursor}' =&gt; array(
    )
  );
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook init - Perform setup tasks. Runs at the beginning of page requests." enabled="true" name="hook_init">/**
 * Implementation of hook_init().
 */
function ${module_name}_init() {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook insert - Respond to node insertion." enabled="true" name="hook_insert">/**
 * Implementation of hook_insert().
 *
 * @param $$node The node being inserted.
 */
function ${module_name}_insert($$node) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook install - Perform module setup tasks." enabled="true" name="hook_install">/**
 * Implementation of hook_install().
 */
function ${module_name}_install() {
  drupal_install_schema('${module_name}');${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook link - Define internal Drupal links." enabled="true" name="hook_link">/**
 * Implementation of hook_link().
 */
function ${module_name}_link($$type, $$object, $$teaser = FALSE) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook link alter - Perform alterations before links on a node are rendered." enabled="true" name="hook_link_alter">/**
 * Implementation of hook_link_alter().
 */
function ${module_name}_link_alter(&amp;$$links, $$node) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook load - Load node-type-specific information." enabled="true" name="hook_load">/**
 * Implementation of hook_load().
 *
 * @param $$node The node being loaded.
 */
function ${module_name}_load($$node) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook locale - Allows modules to define their own text groups that can be translated." enabled="true" name="hook_locale">/**
 * Implementation of hook_locale().
 *
 * @param $$op Type of operation. Currently, only supports 'groups'.
 */
function ${module_name}_locale($$op = 'groups') {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook mail - Prepare a message based on parameters" enabled="true" name="hook_mail">/**
 * Implementation of hook_mail().
 *
 * @param $$key An identifier of the mail.
 * @param $$message An array to be filled in. Keys in this array include: id, to, subject, body, from, headers
 * @param $$params An arbitrary array of parameters set by the caller to drupal_mail.
 */
function ${module_name}_mail($$key, &amp;$$message, $$params) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook mail alter - Alter any aspect of email sent by Drupal." enabled="true" name="hook_mail_alter">/**
 * Implementation of hook_mail_alter().
 *
 * @param $$message A structured array containing the message to be altered. keys in this array include: id, to, subject, body, from, headers
 */
function ${module_name}_mail_alter(&amp;$$message) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook menu - Define menu items and page callbacks." enabled="true" name="hook_menu">/**
 * Implementation of hook_menu().
 *
 * @return An array of menu items.
 */
function ${module_name}_menu() {
  $$items = array();

  $$items['${cursor}'] = array(
    'title' =&gt; '',
    'description' =&gt; '',
    'page callback' =&gt; '',
    'page arguments' =&gt; array()
  );

  return $$items;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook menu alter - Alter the data being saved to the {menu_router} table after hook_menu is invoked." enabled="true" name="hook_menu_alter">/**
 * Implementation of hook_menu_alter().
 *
 * @param $$items Associative array of menu router definitions returned from hook_menu().
 */
function ${module_name}_menu_alter(&amp;$$items) {
  $$items['${cursor}'];
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook menu item" enabled="true" name="hook_menu_item">$$items['${menu_item_location}'] = array(
  'title' =&gt; '${menu_item_title}',
  'description' =&gt; '${menu_item_description}',
  'page callback' =&gt; '${menu_item_callback}',
  'page arguments' =&gt; array('${menu_item_arguments}'),
  'access arguments' =&gt; array('${menu_item_access}'),
  'type' =&gt; ${menu_item_type},
);</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook menu link alter - Alter the data being saved to the {menu_links} table by menu_link_save()." enabled="true" name="hook_menu_link_alter">/**
 * Implementation of hook_menu_link_alter().
 *
 * @param $$item Associative array defining a menu link as passed into menu_link_save().
 * @param $$menu Associative array containg the menu router returned from menu_router_build().
 */
function ${module_name}_menu_link_alter(&amp;$$item, $$menu) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook node access records - Set permissions for a node to be written to the database." enabled="true" name="hook_node_access_records">/**
 * Implementation of hook_node_access_records().
 */
function ${module_name}_node_access_records($$node) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook node grants - Inform the node access system what permissions the user has." enabled="true" name="hook_node_grants">/**
 * Implementation of hook_node_grants().
 *
 * @param $$account The user object whose grants are requested.
 * @param $$op The node operation to be performed, such as "view", "update", or "delete".
 * @return An array whose keys are "realms" of grants such as "user" or "role", and whose values are linear lists of grant IDs.
 */
function ${module_name}_node_grants($$account, $$op) {
  ${cursor}
  return $$grants;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook node info" enabled="true" name="hook_node_info">/**
 * Implementation of hook_node_info().
 *
 * @return An array of information on the ${module_name}'s node types.
 */
function ${module_name}_node_info() {
  return array(
    '${module_name}' =&gt; array(
      'name' =&gt; t('${module_node_name}'),
      'module' =&gt; '${module_name}',
      'description' =&gt; t("${module_node_description}"),
    )
  );
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook node operations - Add mass node operations." enabled="true" name="hook_node_operations">/**
 * Implementation of hook_node_operations().
 */
function ${module_name}_node_operations() {
  $$operations = array(
    '${cursor}' =&gt; array(
      'label' =&gt; t(''),
      'callback' =&gt; ''
    )
  );
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook node type - Act on node type changes." enabled="true" name="hook_node_type">/**
 * Implementation of hook_node_type().
 *
 * @param $$op What is being done to $$info. Possible values: delete, insert, update.
 * @param $$info The node type on which $$op is being performed.
 */
function ${module_name}_node_type($$op, $$info) {
${cursor}  switch ($$op) {
    case 'delete':
      break;
    case 'insert':
      break;
    case 'update':
      break;
  }
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook nodeapi - Act on nodes defined by other modules." enabled="true" name="hook_nodeapi">/**
 * Implementation of hook_nodeapi().
 *
 * @param &amp;$$node The node the action is being performed on.
 * @param $$op What kind of action is being performed. Possible values: alter, delete, delete revision, insert, load, prepare, prepare translation, print, rss item, search result, presave, update, update index, validate, view
 * @param $$a3
 * @param $$a4
 */
function ${module_name}_nodeapi(&amp;$$node, $$op, $$a3 = NULL, $$a4 = NULL) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook permissions - Define user permissions." enabled="true" name="hook_perm">/**
 * Implementation of hook_perm().
 *
 * @return array An array of valid permissions for the ${module_name} module
 */
function ${module_name}_perm() {
  return array('${cursor}');
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook ping - Ping another server." enabled="true" name="hook_ping">/**
 * Implementation of hook_ping().
 *
 * @param $$name The name of your Drupal site.
 * @param $$url The URL of your Drupal site.
 */
function ${module_name}_ping($$name = '', $$url = '') {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook prepare - This is a hook used by node modules. It is called after load but before the node is shown on the add/edit form." enabled="true" name="hook_prepare">/**
 * Implementation of hook_prepare().
 *
 * @param &amp;$$node The node being saved.
 */
function ${module_name}_prepare(&amp;$$node) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook profile_alter - Perform alterations profile items before they are rendered. You may omit/add/re-sort/re-categorize, etc." enabled="true" name="hook_profile_alter">/**
 * Implementation of hook_profile_alter().
 *
 * @param &amp;$$account A user object whose profile is being rendered. Profile items are stored in $$account-&gt;content.
 */
function ${module_name}_profile_alter(&amp;$$account) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook requirements - Check installation requirements and do status reporting.&#10; * Implementation of hook_().&#10; */&#10;function ${module_name}_() {&#10;  ${cursor}&#10;}" enabled="true" name="hook_requirements">/**
 * Implementation of hook_requirements().
 *
 * @param $$phase The phase in which hook_requirements is run: install or runtime.
 */
function ${module_name}_requirements($$phase) {
  return $$requirements['${module_name}'] = array(
    'title' =&gt; $$t(''),
    'value' =&gt; '',
    'severity' =&gt; ${cursor}
  );
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook schema - Define the current version of the database schema." enabled="true" name="hook_schema">/**
 * Implementation of hook_schema().
 */
function ${module_name}_schema() {
  $$schema['${table_name}'] = array(
    'description' =&gt; '',
    'fields' =&gt; array(
      '${cursor}' =&gt; array(
        'description =&gt; '',
      ),
    ),
    'indexes' =&gt; array(
    ),
    'unique keys' =&gt; array(
    ),
    'primary key' =&gt; array(),
  );
  return $$schema;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook schema alter - Perform alterations to existing database schemas." enabled="true" name="hook_schema_alter">/**
 * Implementation of hook_schema_alter().
 *
 * @param &amp;$$schema Nested array describing the schemas for all modules.
 */
function ${module_name}_schema_alter($$schema) {
  $$schema['${cursor}'];
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook schema field" enabled="true" name="hook_schema_field">'${field_name}' =&gt; array(
  'description' =&gt; t('${field_description}'),
  'type' =&gt; '${field_type}',${cursor}
),</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook schema fields skeleton" enabled="true" name="hook_schema_fields">$$schema['${database_table}'] = array(
  'description' =&gt; t('${table_description}'),
  'fields' =&gt; array(
    '${primary_field}' =&gt; array(
      'description' =&gt; t('${field_description}'),
      'type' =&gt; '${field_type}', 
      'not null' =&gt; TRUE
    ),${cursor}
  ),
  'indexes' =&gt; array(),
  'unique keys' =&gt; array(),
  'primary key' =&gt; array('${primary_field}'),
);</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook search - Define a custom search routine." enabled="true" name="hook_search">/**
 * Implementation of hook_search().
 *
 * @param $$op A string defining which operation to perform: admin, name, reset, search, status
 * @param $$keys The search keywords as entered by the user.
 */
function ${module_name}_search($$op = 'search', $$keys = NULL) {
  switch ($$op) {
    case 'name':
      return;

    case 'reset':
      return;

    case 'status':
      return;

    case 'admin':
      return;
      
    case 'search':
      return;
  );
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook search preprocess - Process text for the search index." enabled="true" name="hook_search_preprocess">/**
 * Implementation of hook_search_preprocess().
 *
 * @param $$text The text to split. This is a single piece of plain-text that was extracted from between two HTML tags.
 * @return The text after processing.
 */
function ${module_name}_search_preprocess($$text) {
  ${cursor}
  return $$text;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook system info alter - Alter the information parsed from module and theme .info files" enabled="true" name="hook_system_info_alter">/**
 * Implementation of hook_system_info_alter().
 *
 * @param &amp;$$info The .info file contents, passed by reference so that it can be altered.
 * @param $$file Full information about the module or theme, including $$file-&gt;name, and $$file-&gt;filename.
 */
function ${module_name}_system_info_alter(&amp;$$info, $$file) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook taxonomy - Act on taxonomy changes." enabled="true" name="hook_taxonomy">/**
 * Implementation of hook_taxonomy().
 *
 * @param $$op What is being done to $$array. Possible values: delete, insert, update.
 * @param $$type What manner of item $$array is. Possible values: term, vocabulary.
 * @param $$array The item on which $$op is being performed.
 */
function ${module_name}_taxonomy($$op, $$type, $$array = NULL) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook term path - Allows modules to provide an alternative path for the terms it manages." enabled="true" name="hook_term_path">/**
 * Implementation of hook_term_path().
 *
 * @param $$term A term object.
 * @return An internal Drupal path.
 */
function ${module_name}_term_path($$term) {
  return '${cursor}';
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook theme - Register a module (or theme's) theme implementations." enabled="true" name="hook_theme">/**
 * Implementation of hook_theme().
 */
function ${module_name}_theme($$existing, $$type, $$theme, $$path) {
  return array(
    '${function_name}' =&gt; array(
      'arguments' =&gt; array(${cursor})
    )
  );
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook theme registry alter - Alter the theme registry information returned from hook_theme()." enabled="true" name="hook_theme_registry_alter">/**
 * Implementation of hook_theme_registry_alter().
 *
 * @param $$theme_registry The entire cache of theme registry information, post-processing.
 */
function ${module_name}_theme_registry_alter(&amp;$$theme_registry) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook translated menu link alter - Alter a menu link after it's translated, but before it's rendered." enabled="true" name="hook_translated_menu_link_alter">/**
 * Implementation of hook_translated_menu_link_alter().
 *
 * @param $$item Associative array defining a menu link after _menu_link_translate()
 * @param $$map Associative array containing the menu $$map (path parts and/or objects).
 */
function ${module_name}_translated_menu_link_alter(&amp;$$item, $$map) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook translation link alter - Perform alterations on translation links." enabled="true" name="hook_translation_link_alter">/**
 * Implementation of hook_translation_link_alter().
 *
 * @param $$links Nested array of links keyed by language code.
 * @param $$path The current path.
 */
function ${module_name}_translation_link_alter(&amp;$$links, $$path) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook uninstall - Remove any tables or variables that the module has set." enabled="true" name="hook_uninstall">/**
 * Implementation of hook_uninstall().
 */
function ${module_name}_uninstall() {
  drupal_uninstall_schema('${module_name}');${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook update - Respond to node updating." enabled="true" name="hook_update">/**
 * Implementation of hook_update().
 *
 * @param $$node The node being updated.
 */
function ${module_name}_update($$node) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 update index - Update Drupal's full-text index for this module." enabled="true" name="hook_update_index">/**
 * Implementation of hook_update_index().
 */
function ${module_name}_update_index() {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook update last removed - Return a number which is no longer available as hook_update_N()." enabled="true" name="hook_update_last_removed">/**
 * Implementation of hook_update_last_removed().
 */
function ${module_name}_update_last_removed() {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook update N - Perform a single update." enabled="true" name="hook_update_N">/**
 * Implementation of hook_update_N().
 */
function ${module_name}_update_${update_number}(&amp;$$sandbox = NULL) {
  $$ret = array();
  ${cursor}
  return $$ret;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook update projects alter - Alter the list of projects before fetching data and comparing versions." enabled="true" name="hook_update_projects_alter">/**
 * Implementation of hook_update_projects_alter().
 *
 * @param $$projects Reference to an array of the projects installed on the system.
 */
function ${module_name}_update_projects_alter(&amp;$$projects) {
  $$projects['${cursor}'];
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook update status alter - Alter the information about available updates for projects." enabled="true" name="hook_update_status_alter">/**
 * Implementation of hook_update_status_alter().
 *
 * @param $$projects Reference to an array of information about available updates to each project installed on the system.
 */
function ${module_name}_update_status_alter(&amp;$$projects) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook user - Act on user account actions." enabled="true" name="hook_user">/**
 * Implementation of hook_user().
 *
 * @param $$op What kind of actions is being performed. Possible values: after_update, categories, delete, form, insert, load, login, logout, register, submit, update, validate, view
 * @param &amp;$$edit The array of form values submitted by the user.
 * @param &amp;$$account The user object on which the operation is being performed.
 * @param $$category The active category of user information being edited.
 */
function ${module_name}_user($$op, &amp;$$edit, &amp;$$account, $$category = NULL) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook user operations - Add mass user operations." enabled="true" name="hook_user_operations">/**
 * Implementation of hook_user_operations().
 */
function ${module_name}_user_operations() {
  $$operations = array(
    '${cursor}' =&gt; array(
      'label' =&gt; t(''),
      'callback' =&gt; ''
    )
  );
  return $$operations;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook validate - Verify a node editing form." enabled="true" name="hook_validate">/**
 * Implementation of hook_validate().
 *
 * Validate ${module_node} node type.
 *
 * @param $$node Node to be validated.
 * @param &amp;$$form The node edit form array.
 */
function ${module_node}_validate($$node, &amp;$$form) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook view - Display a node." enabled="true" name="hook_view">/**
 * Implementation of hook_view().
 *
 * @param $$node The node to be displayed.
 * @param $$teaser Whether we are to generate a "teaser" or summary of the node, rather than display the whole thing.
 * @param $$page Whether the node is being displayed as a standalone page.
 */
function ${module_name}_view($$node, $$teaser = FALSE, $$page = FALSE) {
  ${cursor}
  return $$node;
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook watchdog - Log an event message" enabled="true" name="hook_watchdog">/**
 * Implementation of hook_watchdog().
 */
function ${module_name}_watchdog($$log_entry) {
  ${cursor}
}</template><template autoinsert="true" context="php" deleted="false" description="Drupal 6 hook xmlrpc - Register XML-RPC callbacks." enabled="true" name="hook_xmlrpc">/**
 * Implementation of hook_xmlrpc().
 */
function ${module_name}_xmlrpc() {
  return array(
    ${cursor}
  );
}</template></templates>
复制代码

2 、在Zend Studio 中, Window > Preferences > PHP > Editor > Templates > Import.

3、选择 步骤一的XML文件

4、注意那些列表中hook_X的值,点击OK

 

原文见:http://hooknode.com/2010/08/drupal-content-assist-via-zend-studio-eclipse-templates/

posted on   没想到啊  阅读(491)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述
点击右上角即可分享
微信分享提示