feat: pass context to page extensions

Pass the context to page extensions to allow them to make decisions
based on the context. For example, an extension to load the course
specific scripts. This is currently not possible because the course
details are not availale to the page extensions. Made this possible by
passing the context to page extensions.
This commit is contained in:
Anand Chitipothu
2022-01-25 07:12:17 +05:30
parent ec879b12b3
commit 6d4e64059a
2 changed files with 9 additions and 2 deletions

View File

@@ -24,6 +24,11 @@ class PageExtension:
`render_footer()` methods to inject whatever styles/scripts into
the webpage.
"""
def __init__(self):
self.context = frappe._dict()
def set_context(self, context):
self.context = context
def render_header(self):
"""Returns the HTML snippet to be included in the head section