dongyi6543
dongyi6543
2016-01-18 08:22

Drupal的webform模块没有使用webform.api.php

已采纳

I'm working with the Webform module of Drupal 7 and I'm trying to modify the hook_webform_submission_presave in the webform.api.php , but it seems that the module is not using this file because I've made modifications but doesn't change anything.

Do I have to say to Drupal in any place to use this file? Or what do I have to do?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • duanpo2037 duanpo2037 5年前

    First, I hope that you know that you shouldn't change module files directly, but to add hook function to your module and change that "hook" at beginning of function name with your module machine name.

    Second, you have to clear all the caches so Drupal will re-scan your module and figure out that there is new hook function and start using it.

    So, you have to create your own module first:

    https://www.drupal.org/developing/modules/7

    Don't be scared - It's just a folder with an info file describing your module and module file it self (in minimal case).

    Then, if your module is called "anna" you should create a function inside your module file and name it:

    anna_webform_submissions_presave()

    And clear the cache - after that Drupal should start calling your hook function.

    点赞 评论 复制链接分享
  • douyangquan2474 douyangquan2474 5年前

    Modules don't use their .api.php files. These file are there for documentation purpose. That's the standard way for documenting hook definitions.

    点赞 评论 复制链接分享