定制 bitpatroon/typo3_hooks 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bitpatroon/typo3_hooks

Composer 安装命令:

composer require bitpatroon/typo3_hooks

包简介

Extension to easily add hooks in your own code.

README 文档

README

Hooks mechanism for TYPO3

Usage:

processHook

To call a hook, simple add the following code in any class of your code.

\Bitpatroon\Typo3Hooks\Helpers\HooksHelper::processHook(<class>, <hookname>, [<params>]);
  • Class (I) can be the instance, the static reference or the classname i.e.
    • $this
    • self
    • \VENDOR\CALLING_HOOK_CLASS::class
  • Hookname (II) is the name of the hook is the hook,
  • Params (III) is a y reference passed array with values for the hook.

Register the hook

In your or any localconf.php, add the hook.

 $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][\VENDOR\CALLING_HOOK_CLASS::class] = [
        'className' => \VENDOR\CALLED_CLASS::class
 ];
  • CALLING_HOOK_CLASS is the name of the class, as specified in (I).
  • CALLED_CLASS is the name of the class, handling the hook

The class with the hook

Add a TYPO3 class CALLED_CLASS with the following code.

namespace VENDOR;

class CALLED_CLASS
    
    /**
     * Hook
     * @param array $params The parameter Array
     * @param object $ref   The parent object
     */
    public function MyHook(&$params, $ref)
    {
    
    }
}

Notice the $params is by reference. Changing the content affects the original array. $ref is the calling class. See (I).

Notice: Don't forget to reset the cache!

统计信息

  • 总下载量: 6.52k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2019-10-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固