Configuration

Basic Setup

The HookManager requires only a PluginContext:

use WPZylos\Framework\Hooks\HookManager;

$hooks = new HookManager($context);

With HookServiceProvider

When using the service provider, register it in your bootstrap:

$app->register(new HookServiceProvider());

// Then resolve
$hooks = $app->make(HookManager::class);

Prefix Configuration

The prefix comes from your PluginContext:

$context = PluginContext::create([
    'prefix' => 'myplugin_',  // Used for custom hooks
    // ...
]);

Custom hooks will use this prefix:

  • action('saved') ? myplugin_saved
  • filter('output') ? myplugin_output