mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
after_initialize callback for plugins
This commit is contained in:
@ -67,6 +67,19 @@ class Plugin::Instance
|
||||
File.dirname(path) << "/auto_generated"
|
||||
end
|
||||
|
||||
def after_initialize(&block)
|
||||
@after_initialize ||= []
|
||||
@after_initialize << block
|
||||
end
|
||||
|
||||
def notify_after_initialize
|
||||
if @after_initialize
|
||||
@after_initialize.each do |callback|
|
||||
callback.call
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def register_css(style)
|
||||
@styles ||= []
|
||||
@styles << style
|
||||
|
Reference in New Issue
Block a user