Module: CamaleonCms::HooksHelper

Includes:
PluginsHelper
Included in:
CamaleonController, EmailHelper, HtmlMailer
Defined in:
app/helpers/camaleon_cms/hooks_helper.rb

Instance Method Summary collapse

Methods included from PluginsHelper

#current_plugin, #plugin_asset_path, #plugin_asset_url, #plugin_destroy, #plugin_install, #plugin_layout, #plugin_load_helpers, #plugin_uninstall, #plugin_upgrade, #plugin_view, #plugins_initialize, #self_plugin_key

Methods included from SiteHelper

#cama_current_site_host_port, #cama_get_list_layouts_files, #cama_get_list_template_files, #cama_is_test_request?, #current_locale, #current_site, #current_theme, #site_after_install, #site_install_theme, #site_uninstall_theme

Instance Method Details

#hook_run(plugin, hook_key, params = nil) ⇒ Object

execute hooks for plugin_key with action name hook_key non public method plugin: plugin configuration (config.json) hook_key: hook key params: params for hook


9
10
11
# File 'app/helpers/camaleon_cms/hooks_helper.rb', line 9

def hook_run(plugin, hook_key, params = nil)
  _do_hook(plugin, hook_key, params)
end

#hook_skip(hook_function_name) ⇒ Object

skip hook function with name: hook_function_name


29
30
31
# File 'app/helpers/camaleon_cms/hooks_helper.rb', line 29

def hook_skip(hook_function_name)
  @_hooks_skip << hook_function_name
end

#hooks_run(hook_key, params = nil) ⇒ Object

execute all hooks from enabled plugins with key hook_key non public method hook_key: hook key params: params for hook


17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/camaleon_cms/hooks_helper.rb', line 17

def hooks_run(hook_key, params = nil)
  PluginRoutes.enabled_apps(current_site).each do |plugin|
    _do_hook(plugin, hook_key, params)
  end

  # call all anonymous hooks
  PluginRoutes.get_anonymous_hooks(hook_key).each do |_hook|
    _hook.call(params)
  end
end