4

I have created a xblock, now I want to set this xblock as default xblock as an advanced component for every newly created course automatically.

Thanks.

Jay Modi
  • 3,161
  • 4
  • 35
  • 52
Dadaso Zanzane
  • 6,039
  • 1
  • 25
  • 25

3 Answers3

3

the right way to solve this problem is to edit the CourseFields class under common/lib/xmodule/xmodule/course_module.py file. You will find that there is a class variable called advanced_modules with type List. you can just do something like this

advanced_modules = List(
    display_name=_("Advanced Module List"),
    default=[], # this is where you add default values 
    help=_("Enter the names of the advanced components to use in your course."),
    scope=Scope.settings
)
D.W
  • 511
  • 5
  • 9
1

You need to add your XBlock to the list of advanced components. In your CMS settings file, add:

ADVANCED_COMPONENT_TYPES.append('your_xblock')
Régis B.
  • 10,092
  • 6
  • 54
  • 90
0

Setup default advanced component

edit the following file

cms/djangoapps/contentstore/views/components.py

Add the following line to function ‘get_component_templates()’ After

if isinstance(course_advanced_keys, list):

Add

course_advanced_keys.append('your_xblock')
Dadaso Zanzane
  • 6,039
  • 1
  • 25
  • 25