'Creates the context for the fragment\'s template.'

def create_page_context(self, request, course=None, tab=None, **kwargs):

    staff_access = has_access(request.user, 'staff', course)
    supports_preview_menu = tab.get('supports_preview_menu', False)
    if supports_preview_menu:
        (masquerade, masquerade_user) = setup_masquerade(request, course.id, staff_access, reset_masquerade_data=True)
        request.user = masquerade_user
    else:
        masquerade = None
    if (course and (not check_course_open_for_learner(request.user, course))):
        supports_preview_menu = False
    context = {'course': course, 'tab': tab, 'active_page': tab.get('type', None), 'staff_access': staff_access, 'masquerade': masquerade, 'supports_preview_menu': supports_preview_menu, 'uses_pattern_library': True, 'disable_courseware_js': True}
    context.update(get_experiment_user_metadata_context(request, course, request.user))
    return context
