使用 Herbert 执行操作和过滤器

dev-master 2017-03-16 12:38 UTC

This package is not auto-updated.

Last update: 2024-09-18 20:49:08 UTC


README

plugin.php 中添加以下代码以在 Facade 中设置 $app

if ( is_plugin_active(plugin_basename( __FILE__ )) ) {

$plugin = new \Herbert\Framework\Base\Plugin(plugin_dir_path( __FILE__ ));

$herbert->registerPlugin($plugin);

$app = $plugin->getContainer();

FlycartHook\Facades\Facade::setFacadeApplication($app);

}

herbert.config.php 中添加以下代码以加载 FlycartHook 服务提供者

'providers' => array(

FlycartHook\HookServiceProvider::class

)

Flycart Hook 示例

\FlycartHook\Facades\Action::add('init', 'ClassName@functionName');

\FlycartHook\Facades\Action::run('eventname', $args);

\FlycartHook\Facades\Filter::add('eventname', 'ClassName@functionName');

\FlycartHook\Facades\Filter::run('eventname', $args);