Ejemplo n.º 1
0
/**
 * This processes all template hooks for a particular template location (e.g. edit client page, at the top).
 * It works similarly to the ft_process_hooks function, except there are no options to override values in the
 * template. This is used purely to insert content into the templates.
 *
 * @param string $location
 * @param array an array of all variables currently in the template
 * @param array in most cases, template hooks just contain the single "location" parameter which identifies
 *     where the hook is from. But hooks may also contain any additional rbitrary attribute names. This
 *     param contains all of them.
 */
function ft_process_template_hook_calls($location, $template_vars, $all_params = array())
{
    $hooks = ft_get_hook_calls($location, "template", "");
    // extract the var passed from the calling function into the current scope
    foreach ($hooks as $hook_info) {
        $module_folder = $hook_info["module_folder"];
        if (!ft_check_module_enabled($module_folder)) {
            continue;
        }
        // add the hook info to the $template_vars for access by the hooked function. N.B. the "form_tools_"
        // prefix was added to reduce the likelihood of naming conflicts with variables in any Form Tools page
        $template_vars["form_tools_hook_info"] = $hook_info;
        ft_process_template_hook_call($hook_info["module_folder"], $hook_info["hook_function"], $location, $template_vars, $all_params);
    }
}
Ejemplo n.º 2
0
/**
 * Added in 2.1.6. This can be used for conditional logic to determine whether or not a module overrides
 * a particular chunk of Smarty content.
 *
 * @param string $hook
 */
function smarty_modifier_hook_call_defined($hook)
{
    $hook_calls = ft_get_hook_calls($hook, "template", "");
    return !empty($hook_calls);
}