Module: CamaleonCms::HookLifecycleConcern

Extended by:
ActiveSupport::Concern
Included in:
CamaleonController
Defined in:
app/controllers/concerns/camaleon_cms/hook_lifecycle_concern.rb

Instance Method Summary collapse

Instance Method Details

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



5
6
7
# File 'app/controllers/concerns/camaleon_cms/hook_lifecycle_concern.rb', line 5

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

#hook_skip(hook_function_name) ⇒ Object



20
21
22
# File 'app/controllers/concerns/camaleon_cms/hook_lifecycle_concern.rb', line 20

def hook_skip(hook_function_name)
  hook_skip_list << hook_function_name
end

#hooks_run(hook_key, params = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/concerns/camaleon_cms/hook_lifecycle_concern.rb', line 9

def hooks_run(hook_key, params = nil)
  theme_slug = current_theme&.slug.presence || current_site.get_theme_slug
  PluginRoutes.enabled_apps(current_site, theme_slug).each do |plugin|
    _do_hook(plugin, hook_key, params)
  end

  PluginRoutes.get_anonymous_hooks(hook_key).each do |_hook|
    _hook.call(params)
  end
end