Module: CamaleonCms::HooksHelper

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

Overview

Camaleon CMS is a content management system

Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  GNU Affero General Public License (GPLv3) for more details.

Instance Method Summary collapse

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



15
16
17
# File 'app/helpers/camaleon_cms/hooks_helper.rb', line 15

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



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

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



23
24
25
26
27
# File 'app/helpers/camaleon_cms/hooks_helper.rb', line 23

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