public function processHookBlock($params, $content, $smarty, &$repeat)
    {
        $hookName = $this->getParam($params, 'name');
        $module   = intval($this->getParam($params, 'module', 0));
        // explicit definition of variable that can be returned
        $fields   = preg_replace(
            '|[^a-zA-Z0-9,\-_]|',
            '',
            $this->getParam($params, 'fields', '')
        );
        $fields = ('' !== $fields) ? explode(",", $fields) : [];

        if (!$repeat) {
            if ($this->debug && $smarty->getRequest()->get('SHOW_HOOK')) {
                $content = self::showHook($hookName, $params) . $content;
            }

            return $content;
        }

        $type = $smarty->getTemplateDefinition()->getType();

        $event = new HookRenderBlockEvent($hookName, $params, $fields, $smarty->getTemplateVars());

        $event->setArguments($this->getArgumentsFromParams($params));

        $eventName = sprintf('hook.%s.%s', $type, $hookName);

        // this is a hook specific to a module
        if (0 !== $module) {
            $eventName .= '.' . $module;
        }

        $this->getDispatcher()->dispatch($eventName, $event);

        // save results so we can use it in forHook block
        $this->hookResults[$hookName] = $event->get();
    }