Skip to content

Commit c45cad1

Browse files
igobrancosandroscosta
authored andcommitted
feat: add user certificate to Certificate render start context
Add the user certificate to the CertificateRenderStarted Open edX filter context, so it is possible to have complex filtering and applying custom logic to the course certificate presentation. fccn/nau-technical#667
1 parent d149e34 commit c45cad1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lms/djangoapps/certificates/views/webview.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,21 @@ def render_html_view(request, course_id, certificate=None): # pylint: disable=t
585585
context.update(get_certificate_header_context(is_secure=request.is_secure()))
586586
context.update(get_certificate_footer_context())
587587

588+
# Append/Override the existing view context values with plugin defined values
589+
run_extension_point(
590+
'NAU_CERTIFICATE_CONTEXT_EXTENSION',
591+
context=context,
592+
request=request,
593+
course=course,
594+
user=user,
595+
user_certificate=user_certificate,
596+
configuration=configuration,
597+
certificate_language=certificate_language,
598+
)
599+
600+
# NAU Customization so the filter know which certificate is being rendered
601+
context['user_certificate'] = user_certificate
602+
588603
# Append/Override the existing view context values with any course-specific static values from Advanced Settings
589604
context.update(course.cert_html_view_overrides)
590605

0 commit comments

Comments
 (0)