Wallogit.com
2017 © Pedro Peláez
Do action and filters with Herbert
Add the bellow piece of code in plugin.php to set $app in Facade, (*1)
if ( is_plugin_active(plugin_basename( __FILE__ )) ) {, (*2)
$plugin = new \Herbert\Framework\Base\Plugin(plugin_dir_path( __FILE__ ));, (*3)
$herbert->registerPlugin($plugin);, (*4)
$app = $plugin->getContainer();, (*5)
FlycartHook\Facades\Facade::setFacadeApplication($app);, (*6)
}, (*7)
Add the bellow piece of code in herbert.config.php to load FlycartHook service provider, (*8)
'providers' => array(, (*9)
FlycartHook\HookServiceProvider::class, (*10)
), (*11)
# Flycart Hook Example, (*12)
\FlycartHook\Facades\Action::add('init', 'ClassName@functionName');, (*13)
\FlycartHook\Facades\Action::run('eventname', $args);, (*14)
\FlycartHook\Facades\Filter::add('eventname', 'ClassName@functionName');, (*15)
\FlycartHook\Facades\Filter::run('eventname', $args);, (*16)