diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c867145f20..48b38ed88f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -435,7 +435,7 @@ class ApplicationController < ActionController::Base end DiscoursePluginRegistry.html_builders.each do |name, blk| - data[name] = blk.call + data[name] = blk.call(self) end MultiJson.dump(data) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0b37380f2c..404ed92bf4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -318,7 +318,7 @@ module ApplicationHelper def build_plugin_html(name) return "" unless allow_plugins? - DiscoursePluginRegistry.build_html(name) || "" + DiscoursePluginRegistry.build_html(name, controller) || "" end def theme_lookup(name) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index f86a11fc50..9e94ba7695 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -53,6 +53,8 @@ <%- end %> <%= yield :head %> + + <%= raw build_plugin_html 'before-head-close' %> @@ -121,5 +123,6 @@ <%- unless customization_disabled? %> <%= raw theme_lookup("body_tag") %> <%- end %> + <%= raw build_plugin_html 'before-body-close' %> diff --git a/lib/discourse_plugin_registry.rb b/lib/discourse_plugin_registry.rb index 99aaaf88a9..edbf11c761 100644 --- a/lib/discourse_plugin_registry.rb +++ b/lib/discourse_plugin_registry.rb @@ -134,8 +134,8 @@ class DiscoursePluginRegistry html_builders[name] = block end - def self.build_html(name) - html_builders[name]&.call + def self.build_html(name, ctx) + html_builders[name]&.call(ctx) end def javascripts