<small id='yagmu'></small><noframes id='yagmu'>

<i id='yagmu'><tr id='yagmu'><dt id='yagmu'><q id='yagmu'><span id='yagmu'><b id='yagmu'><form id='yagmu'><ins id='yagmu'></ins><ul id='yagmu'></ul><sub id='yagmu'></sub></form><legend id='yagmu'></legend><bdo id='yagmu'><pre id='yagmu'><center id='yagmu'></center></pre></bdo></b><th id='yagmu'></th></span></q></dt></tr></i><div id='yagmu'><tfoot id='yagmu'></tfoot><dl id='yagmu'><fieldset id='yagmu'></fieldset></dl></div>

      <legend id='yagmu'><style id='yagmu'><dir id='yagmu'><q id='yagmu'></q></dir></style></legend><tfoot id='yagmu'></tfoot>
          <bdo id='yagmu'></bdo><ul id='yagmu'></ul>

      1. 你能在 Drupal 中创建你自己的 Hook 吗?

        Can you Create your Own Hook in Drupal?(你能在 Drupal 中创建你自己的 Hook 吗?)
      2. <tfoot id='yGRxj'></tfoot>
        <legend id='yGRxj'><style id='yGRxj'><dir id='yGRxj'><q id='yGRxj'></q></dir></style></legend>

      3. <i id='yGRxj'><tr id='yGRxj'><dt id='yGRxj'><q id='yGRxj'><span id='yGRxj'><b id='yGRxj'><form id='yGRxj'><ins id='yGRxj'></ins><ul id='yGRxj'></ul><sub id='yGRxj'></sub></form><legend id='yGRxj'></legend><bdo id='yGRxj'><pre id='yGRxj'><center id='yGRxj'></center></pre></bdo></b><th id='yGRxj'></th></span></q></dt></tr></i><div id='yGRxj'><tfoot id='yGRxj'></tfoot><dl id='yGRxj'><fieldset id='yGRxj'></fieldset></dl></div>

            <small id='yGRxj'></small><noframes id='yGRxj'>

                <tbody id='yGRxj'></tbody>
                <bdo id='yGRxj'></bdo><ul id='yGRxj'></ul>
                  本文介绍了你能在 Drupal 中创建你自己的 Hook 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以在 Drupal 模块中创建您自己的钩子供其他 Drupal 模块使用?如果没有,Drupal 中是否有第三方开发人员提供钩子的机制?如果到目前为止一切都没有,那么在核心中实现的钩子列表在哪里?

                  Is it possible to create your own hook in a Drupal module for other Drupal modules to consume? If not, is there a mechanism in Drupal for third party developers to provide hooks? If everything's been a no so far, where in the core are the list of hooks implemented?

                  据我所知,Drupal 模块在一个名为 的系统上工作钩子.当您创建新模块时,您将创建实现挂钩的函数.例如,有一个 hook_delete 钩子.如果你在你的模块中实现了一个函数

                  As I understand things, Drupal modules work on a event like system called hooks. When you create a new module, you create functions that implement a hook. For example, there's a hook_delete hook. If you implement a function in your module

                  function mymodule_delete($node)
                  {
                  }
                  

                  每当删除节点时都会调用此函数.

                  this function will be called whenever a node is deleted.

                  我想知道的是,作为第三方模块开发人员,有没有办法创建我自己的钩子.比如说,像 hook_alanskickbutthook 这样的东西,以便其他模块开发人员可以订阅这个钩子.

                  What I want to know is, is there a way or me, as a third party module developer, to create my own hooks. Say, something like hook_alanskickbutthook so that other module developers could subscribe to this hook.

                  如果可以,你会怎么做?我查看了官方文档,并没有找到太多内容,当我开始查看 Drupal 源代码时,我仍然有点头晕(我了解递归,但没有花足够的时间考虑递归问题).欢迎提供完整的解决方案,但我很高兴能指出正确的方向.

                  If this is possible, how do you do it? I've looked around the official docs and haven't found much there, and I still get a little dizzy when I start poking around the Drupal source code (I understand recursion, but don't spend enough time thinking about recursive problems). Full solutions are welcome, but I'm happy to just be pointed in the right direction.

                  推荐答案

                  Module_invoke_all() 是您创建自己的钩子的门票:

                  Module_invoke_all() is your ticket to creating your own hooks:

                  查看 API:

                  http://api.drupal.org/api/drupal/includes--module.inc/function/module_invoke_all

                  然后看看这篇很棒的文章:

                  and then look at this great writeup:

                  http://web.archive.org/web/20101227170201/http://himerus.com/blog/himerus/creating-hooks-your-drupal-modules

                  (位于 http://himerus.com/blog/himerus/creating-hooks-your-drupal-modules 但现在已经没有了)

                  (edit: was at http://himerus.com/blog/himerus/creating-hooks-your-drupal-modules but this is now gone)

                  创建钩子后,可以使用以下命令在另一个模块中调用它:

                  Once you've made your hook, it can be called in another module using:

                  /**
                   * Implementation of hook_myhookname()
                   */
                  
                  function THISMODULENAME_myhookname(args){
                    //do stuff
                  }
                  

                  这篇关于你能在 Drupal 中创建你自己的 Hook 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                      <bdo id='QooJy'></bdo><ul id='QooJy'></ul>

                      <small id='QooJy'></small><noframes id='QooJy'>

                    • <legend id='QooJy'><style id='QooJy'><dir id='QooJy'><q id='QooJy'></q></dir></style></legend>

                      <tfoot id='QooJy'></tfoot>
                    • <i id='QooJy'><tr id='QooJy'><dt id='QooJy'><q id='QooJy'><span id='QooJy'><b id='QooJy'><form id='QooJy'><ins id='QooJy'></ins><ul id='QooJy'></ul><sub id='QooJy'></sub></form><legend id='QooJy'></legend><bdo id='QooJy'><pre id='QooJy'><center id='QooJy'></center></pre></bdo></b><th id='QooJy'></th></span></q></dt></tr></i><div id='QooJy'><tfoot id='QooJy'></tfoot><dl id='QooJy'><fieldset id='QooJy'></fieldset></dl></div>

                          <tbody id='QooJy'></tbody>