DEV: Add category custom field preloading to CategoryList (#23969)

This commit also introduced a plugin API for preloading category custom
fields.
This commit is contained in:
Angus McLeod
2023-10-26 21:34:23 +08:00
committed by GitHub
parent b8ee52c4cb
commit 2a75656ff2
4 changed files with 69 additions and 0 deletions

View File

@ -290,6 +290,13 @@ class Plugin::Instance
Upload.add_in_use_callback(&block)
end
# Registers a category custom field to be loaded when rendering a category list
# Example usage:
# register_category_list_preloaded_category_custom_fields("custom_field")
def register_category_list_preloaded_category_custom_fields(field)
CategoryList.preloaded_category_custom_fields << field
end
def custom_avatar_column(column)
reloadable_patch do |plugin|
UserLookup.lookup_columns << column