File tree Expand file tree Collapse file tree
lms/djangoapps/instructor/views Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313from django .utils .html import escape
1414from django .utils .translation import gettext as _
1515from edx_when .api import is_enabled_for_course
16+ from openedx_filters .learning .filters import InstructorDashboardTabsGenerated
1617from rest_framework import serializers
1718
1819from common .djangoapps .course_modes .models import CourseMode
@@ -322,7 +323,20 @@ def get_tabs(self, data):
322323 ]
323324 order_index = {tab : i for i , tab in enumerate (tabs_order )}
324325 tabs = sorted (tabs , key = lambda x : order_index .get (x ['tab_id' ], float ("inf" )))
325- return tabs
326+
327+ # Apply the InstructorDashboardTabsGenerated filter to allow plugins to modify tabs
328+ try :
329+ filtered_tabs = InstructorDashboardTabsGenerated .run_filter (
330+ tabs = tabs ,
331+ course = course ,
332+ user = request .user ,
333+ course_key = course_key
334+ )
335+ return filtered_tabs if filtered_tabs is not None else tabs
336+ except InstructorDashboardTabsGenerated .PreventTabsGeneration as exc :
337+ # Plugin provided custom tabs or prevented tab generation
338+ custom_tabs = getattr (exc , 'tabs' , [])
339+ return custom_tabs
326340
327341 def get_course_id (self , data ):
328342 """Get course ID as string."""
You can’t perform that action at this time.
0 commit comments