feat: allow overriding unit icons (#21433)

This:
1. Introduces a new override using the `pluggable_override` decorator.
It is now possible to specify a custom way of getting XBlock's icon
by defining `GET_UNIT_ICON_IMPL` in settings.
2. Introduces a way to add custom `XBLOCK_MIXINS` by defining
`XBLOCK_EXTRA_MIXINS` in settings. This allows, e.g. to add
new fields to XBlocks.
This commit is contained in:
Piotr Surowiec
2021-04-07 15:42:12 +02:00
committed by GitHub
parent 3d20c848f8
commit bc1e9afe4b
7 changed files with 26 additions and 3 deletions

View File

@@ -563,6 +563,7 @@ VIDEO_UPLOAD_PIPELINE:
ROOT_PATH: ''
WIKI_ENABLED: true
WRITABLE_GRADEBOOK_URL: null
XBLOCK_EXTRA_MIXINS: []
XBLOCK_FS_STORAGE_BUCKET: null
XBLOCK_FS_STORAGE_PREFIX: null
XBLOCK_SETTINGS: {}

View File

@@ -1424,6 +1424,7 @@ from xmodule.x_module import XModuleMixin
# This should be moved into an XBlock Runtime/Application object
# once the responsibility of XBlock creation is moved out of modulestore - cpennington
XBLOCK_MIXINS = (LmsBlockMixin, InheritanceMixin, XModuleMixin, EditInfoMixin)
XBLOCK_EXTRA_MIXINS = ()
# .. setting_name: XBLOCK_SELECT_FUNCTION
# .. setting_default: prefer_xmodules

View File

@@ -1047,3 +1047,6 @@ EXPLICIT_QUEUES = {
}
LOGO_IMAGE_EXTRA_TEXT = ENV_TOKENS.get('LOGO_IMAGE_EXTRA_TEXT', '')
############## XBlock extra mixins ############################
XBLOCK_MIXINS += tuple(XBLOCK_EXTRA_MIXINS)