### MFE Configuration API Request Example Source: https://github.com/openedx/openedx-platform/blob/master/lms/djangoapps/mfe_config_api/docs/decisions/0001-mfe-config-api.rst Example GET request to the MFE configuration API, specifying a particular MFE to retrieve its configuration. ```http GET http://lms.base.com/api/mfe_config/v1?mfe=learning ``` -------------------------------- ### Install and Prepare CodeMirror Plugin Source: https://github.com/openedx/openedx-platform/blob/master/common/static/js/vendor/tinymce/BUILD_README.md Install Node.js dependencies and prepare the minified file for the CodeMirror plugin. ```bash npm install npm run prepublish ``` -------------------------------- ### YAML Reference Import Example Source: https://github.com/openedx/openedx-platform/blob/master/docs/decisions/0007-sys-path-modification-removal.rst Provides an example of a module reference within a YAML configuration. ```yaml KEY_FUNCTION: util.memcache.safe_key ``` -------------------------------- ### Stanford Theming: lms-main.scss Example Source: https://github.com/openedx/openedx-platform/blob/master/themes/README.rst Example Sass file for Stanford theming, setting the static path and importing base styles and default overrides. ```scss $static-path: '../../../..'; @import 'lms/static/sass/lms-main'; @import '_default'; ``` -------------------------------- ### Display Advertised Start Date Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/course.html Shows the 'Starts' date if advertised_start is available, otherwise displays 'Starts:' with no date. ```html % if course.advertised_start is not None: ${\ _("Starts")}: ${course.advertised_start} % else: % endif ``` ```html * ${course.display_org_with_default} * ${course.display_number_with_default} % if course.advertised_start is not None:* ${\ _("Starts")}: ${course.advertised_start} % else:* ${\ _("Starts")}: % endif ``` -------------------------------- ### Format Course Start Date Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/course.html Formats the course start date into an ISO 8601 string if available, otherwise remains empty. ```html <% if course.start is not None: course_date_string = course.start.strftime('%Y-%m-%dT%H:%M:%S%z') else: course_date_string = '' %> ``` -------------------------------- ### Direct Import Example Source: https://github.com/openedx/openedx-platform/blob/master/docs/decisions/0007-sys-path-modification-removal.rst Illustrates a direct import statement that needs to be updated. ```python import courseware.views ``` -------------------------------- ### Start Xqueue-Watcher Service Source: https://github.com/openedx/openedx-platform/blob/master/xmodule/docs/decisions/0005-send-data-to-edx-submission.rst Start the Xqueue-Watcher service to monitor the Xqueue. Ensure the service is running and accessible. ```bash python watcher.py ``` -------------------------------- ### Install localtunnel Source: https://github.com/openedx/openedx-platform/blob/master/openedx/core/djangoapps/oauth_dispatch/docs/how_tos/testing_manually.rst Install the localtunnel package globally using npm. ```bash npm install -g localtunnel ``` -------------------------------- ### Install and Enable Tutor Legacy JS Plugin Source: https://github.com/openedx/openedx-platform/blob/master/docs/concepts/testing/testing.rst Installs and enables the test-legacy-js plugin for Tutor Dev to run Javascript unit tests. ```bash tutor plugins install https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-test-legacy-js tutor plugins enable test-legacy-js tutor images build openedx-dev ``` -------------------------------- ### Compile XBlock Translations Example Source: https://github.com/openedx/openedx-platform/blob/master/docs/decisions/0019-oep-58-atlas-translations-design.rst This example shows the commands executed by compile_xblock_translations for a specific XBlock, including generating .mo files and compiling JavaScript translations. ```bash i18n_tool generate -v python manage.py compilejsi18n --namespace DragAndDropI18N --output conf/plugins-locale/drag_and_drop_v2/js/ ``` -------------------------------- ### API Endpoint for Course Apps (GET) Source: https://github.com/openedx/openedx-platform/blob/master/openedx/core/djangoapps/course_apps/docs/decisions/001-course-apps.rst Example of a GET request to retrieve the list of course apps for a specific course ID. ```http GET ``/course_apps/v1/apps/{course_id}/`` ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/openedx/openedx-platform/blob/master/docs/references/static-assets.rst Installs development dependencies for building frontend assets. Ensure you have Node.js and a Python environment set up. ```bash npm clean-install pip install -r requirements/edx/assets.txt ``` -------------------------------- ### Example Driver Configuration File Source: https://github.com/openedx/openedx-platform/blob/master/scripts/user_retirement/docs/driver_setup.rst This YAML configuration file specifies client credentials, base URLs for services, and the retirement pipeline stages. ```yaml client_id: client_secret: base_urls: lms: https://courses.example.com/ ecommerce: https://ecommerce.example.com/ credentials: https://credentials.example.com/ retirement_pipeline: - ['RETIRING_EMAIL_LISTS', 'EMAIL_LISTS_COMPLETE', 'LMS', 'retirement_retire_mailings'] - ['RETIRING_ENROLLMENTS', 'ENROLLMENTS_COMPLETE', 'LMS', 'retirement_unenroll'] - ['RETIRING_LMS_MISC', 'LMS_MISC_COMPLETE', 'LMS', 'retirement_lms_retire_misc'] - ['RETIRING_LMS', 'LMS_COMPLETE', 'LMS', 'retirement_lms_retire'] ``` -------------------------------- ### Example Theme Directory Structure Source: https://github.com/openedx/openedx-platform/blob/master/themes/README.rst Illustrates the expected directory and file structure for a custom Open edX theme. ```text my-theme └── lms ├── static │   ├── images │   │   └── logo.png │   └── sass │   ├── _overrides.scss │   ├── lms-main-rtl.scss │   └── lms-main.scss └── templates ├── footer.html └── header.html ``` -------------------------------- ### Course App Configuration Class Example Source: https://github.com/openedx/openedx-platform/blob/master/openedx/core/djangoapps/course_apps/docs/decisions/001-course-apps.rst Example of a Python class defining metadata and behavior for a course app. It includes methods for checking availability, enabled status, and allowed operations. ```python # The app id should match what is specified in the pyproject.toml entrypoint app_id: str = 'wiki' name: str = 'Wiki' description: str = 'A short description of what the Wiki does.' # Specify if this app is enabled by default. If the app is made available for a course # should it also automatically be considered enabled. default_enabled: bool = False # This method will not be in the sample/base class, but will be added to # existing Course Apps. if LEGACY_APP: @classmethod def legacy_link(cls, course_key): return f'some/link/to/{course_key}' @classmethod def is_available(cls, course_key): # Some mechanism, ideally a waffle flag in the Course Apps namespace # to see if this app can be enabled/configured for this course. return True @classmethod def is_enabled(cls, course_key): # Some logic to check if the app is enabled for this course # This will not vary from user-to-user in studio. return True @classmethod def set_enabled(cls, course_key, user, enabled): # Some logic to enable the app for this course. # The user here isn't passed on for permission checking, but just # for logging/auditing. return enabled @classmethod def get_allowed_operations(cls, course_key, user): # This should return a dictionary with at least the `enable` and `configure` keys. return { 'enable': can_user_enable(course_key, user), 'configure': can_user_configure(course_key, user), } ``` -------------------------------- ### Install Xqueue-Watcher Dependencies Source: https://github.com/openedx/openedx-platform/blob/master/xmodule/docs/decisions/0005-send-data-to-edx-submission.rst Install the necessary Python dependencies for the Xqueue-Watcher service. This is typically done after cloning the repository. ```bash cd xqueue-watcher pip install -r requirements.txt ``` -------------------------------- ### Install Pip Packages Source: https://github.com/openedx/openedx-platform/blob/master/scripts/user_retirement/README.rst Installs the required pip packages for the user retirement scripts using a requirements file. ```bash pip install -r scripts/user_retirement/requirements/base.txt ``` -------------------------------- ### Install Pip Packages Source: https://github.com/openedx/openedx-platform/blob/master/scripts/structures_pruning/README.rst Install the required Python packages for the structures pruning scripts using the provided requirements file. Ensure the virtual environment is activated. ```bash pip install -r scripts/structures_pruning/requirements/base.txt ``` -------------------------------- ### JavaScript Setup for Debug Information Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/ux/reference/fragments/unit-fragment.html Initializes the debug functionality for a specific module, passing its location and configuration. This script assumes the courseware.html has loaded. ```javascript $(function () { setup_debug('0b9e39477cf34507a7a48f74be381fdd', null, { 'location': 'block\u002Dv1:edX+DemoX+Demo_Course+type@video+block@0b9e39477cf34507a7a48f74be381fdd', 'xqa_key': 'qaijS3UatK020Wc0sfCtFe0V6jpB4d64', 'category': 'VideoModuleWithMixins', 'user': 'AndyA' } ); }); ``` -------------------------------- ### Install Testing Requirements Source: https://github.com/openedx/openedx-platform/blob/master/scripts/user_retirement/README.rst Installs the necessary pip packages for running test cases. ```bash pip install -r scripts/user_retirement/requirements/testing.txt ``` -------------------------------- ### HTML Module Setup Script Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/ux/reference/fragments/unit-fragment.html JavaScript code to set up a debug instance for an HTML module. It assumes the courseware.html has loaded the necessary methods. ```javascript $(function () { setup_debug('030e35c4756a4ddc8d40b95fbbfff4d4', null, { 'location': 'block\u002Dv1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4', 'xqa_key': 'qaijS3UatK020Wc0sfCtFe0V6jpB4d64', 'category': 'HtmlModuleWithMixins', 'user': 'AndyA' } ); }); ``` -------------------------------- ### Submission History Viewer Setup Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/ux/reference/fragments/unit-fragment.html JavaScript code to set up the debug functionality for the submission history viewer. Assumes courseware.html has loaded this method. ```javascript $(function () { setup_debug('030e35c4756a4ddc8d40b95fbbfff4d4', null, { 'location': 'block\u002Dv1:edX+DemoX+Demo_Course+type@html+block@030e35c4756a4ddc8d40b95fbbfff4d4', 'xqa_key': 'qaijS3UatK020Wc0sfCtFe0V6jpB4d64', 'category': 'HtmlModuleWithMixins', 'user': 'AndyA' } ); }); ``` -------------------------------- ### Example Certificate Configuration in MongoDB Source: https://github.com/openedx/openedx-platform/blob/master/lms/djangoapps/certificates/docs/decisions/007-transfer-certificate-signatures-from-mongo.rst Illustrates the structure of certificate configuration, including signatory details and signature image paths, as stored in MongoDB. ```json { "certificates": { "certificates": [ { "id": 853888039, "name": "Name of the certificate", "description": "Description of the certificate", "is_active": true, "version": 1, "signatories": [ { "name": "Name", "title": "Title", "organization": "Organization", "signature_image_path": "/c4x/ooniversity/DJ101/asset/png-transparent-circle-white-circle-white-monochrome-black-thumbnail.png", "certificate": 853888039, "id": 1300534915 } ], "course_title": "cert" } ] } } ``` -------------------------------- ### Pending Task Example Source: https://github.com/openedx/openedx-platform/blob/master/lms/static/js/fixtures/instructor_dashboard/student_admin.html Displays an example of a pending task for rescoring a problem, including task inputs, ID, requester, submission time, and state. ```JSON {"entrance_exam_url": "i4x://PU/FSc/chapter/d2204197cce443c4a0d5c852d4e7f638", "student": "audit"} ``` -------------------------------- ### CourseTab Plugin Manager Example Source: https://github.com/openedx/openedx-platform/blob/master/openedx/core/djangoapps/course_apps/docs/decisions/001-course-apps.rst Example of a PluginManager subclass for discovering course tabs. It defines a namespace and a method to retrieve available tab types. ```python class CourseTabPluginManager(PluginManager): """ Manager for all of the course tabs that have been made available. All course tabs should implement `CourseTab`. """ NAMESPACE = COURSE_TAB_NAMESPACE @classmethod def get_tab_types(cls): """ Returns the list of available course tabs in their canonical order. ``` -------------------------------- ### Markdown Formatting Examples Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/wiki/includes/cheatsheet.html Demonstrates various Markdown syntax for text styling, including emphasis and strong text. ```markdown *emphasis* or _emphasis_ ``` ```markdown **strong** or __strong__ ``` -------------------------------- ### String Reference Import Example Source: https://github.com/openedx/openedx-platform/blob/master/docs/decisions/0007-sys-path-modification-removal.rst Demonstrates a string reference to a module, often used in patching or configuration. ```python @patch('edxmako.LOOKUP', {}) ``` -------------------------------- ### Direct 'from' Import Example Source: https://github.com/openedx/openedx-platform/blob/master/docs/decisions/0007-sys-path-modification-removal.rst Shows a direct 'from' import statement that requires modification. ```python from contentstore.models import VideoUploadConfig ``` -------------------------------- ### XBlock Entry Point Tag Example Source: https://github.com/openedx/openedx-platform/blob/master/docs/decisions/0019-oep-58-atlas-translations-design.rst Demonstrates how an XBlock's entry point tag is defined in its setup.py file. This tag is used to identify the XBlock. ```python entry_points={ 'xblock.v1': 'drag-and-drop-v2 = drag_and_drop_v2:DragAndDropBlock', } ``` -------------------------------- ### Initialize XBlock View and Event Handlers Source: https://github.com/openedx/openedx-platform/blob/master/cms/templates/container.html Sets up an XBlock view for authoring, including event listeners for clipboard operations and adding new units. It also handles dropdown toggles for actions. ```javascript require(["js/models/xblock_info", "js/views/xblock", "js/views/utils/xblock_utils", "common/js/components/utils/view_utils", "gettext"], function (XBlockInfo, XBlockView, XBlockUtils, ViewUtils, gettext) { var model = new XBlockInfo({ id: '${subsection.location|n, decode.utf8}' }); var xblockView = new XBlockView({ model: model, el: $('#sequence-nav'), view: 'author_view?position=${position|n, decode.utf8}&next_url=${next_url|n, decode.utf8}&prev_url=${prev_url|n, decode.utf8}', clipboardData: ${user_clipboard | n, dump_js_escaped_json}, }); xblockView.xblockReady = function() { var toggleCaretButton = function(clipboardData) { if (clipboardData && clipboardData.content && clipboardData.source_usage_key.includes("vertical")) { $('.dropdown-toggle-button').show(); } else { $('.dropdown-toggle-button').hide(); $('.dropdown-options').hide(); } }; this.clipboardBroadcastChannel = new BroadcastChannel("studio_clipboard_channel"); this.clipboardBroadcastChannel.onmessage = (event) => { toggleCaretButton(event.data); }; toggleCaretButton(this.options.clipboardData); $('#new-unit-button').on('click', function(event) { event.preventDefault(); XBlockUtils.addXBlock($(this)).done(function(locator) { ViewUtils.redirect('/container/' + locator + '?action=new'); }); }); $('.custom-dropdown .dropdown-toggle-button').on('click', function(event) { event.stopPropagation(); // Prevent the event from closing immediately when we open it $(this).next('.dropdown-options').slideToggle('fast'); // This toggles the dropdown visibility var isExpanded = $(this).attr('aria-expanded') === 'true'; $(this).attr('aria-expanded', !isExpanded); }); $('.seq_paste_unit').on('click', function(event) { event.preventDefault(); $('.dropdown-options').hide(); XBlockUtils.pasteXBlock($(this)).done(function(data) { ViewUtils.redirect('/container/' + data.locator + '?action=new'); }); }); }; xblockView.render(); }); ``` -------------------------------- ### Pending Task Row Example Source: https://github.com/openedx/openedx-platform/blob/master/lms/static/js/fixtures/instructor_dashboard/student_admin.html An example row from the 'Pending Tasks' table, showing details of a 'rescore_problem' task. ```text rescore_problem {"entrance_exam_url": "i4x://PU/FSc/chapter/d2204197cce443c4a0d5c852d4e7f638", "student": "audit"} 9955d413-eac1-441f-978d-27c60dd1c946 staff 2015-02-19T10:59:01+00:00 unknown QUEUING Incomplete No status information available ``` -------------------------------- ### Install Testing Requirements Source: https://github.com/openedx/openedx-platform/blob/master/scripts/structures_pruning/README.rst Install the necessary pip packages for running test cases. This command should be executed before running pytest. ```bash pip install -r scripts/structures_pruning/requirements/testing.txt ``` -------------------------------- ### Run Command with Settings Source: https://github.com/openedx/openedx-platform/blob/master/openedx/core/djangoapps/schedules/docs/README.rst How to run a management command specifying the settings file, useful for development environments like devstack. ```bash ./manage.py lms --settings devstack send_recurring_nudge example.com ``` -------------------------------- ### Hard-coded Style Example Source: https://github.com/openedx/openedx-platform/blob/master/docs/concepts/frontend/bootstrap.rst An example of a CSS style with hard-coded font and color values. This approach is discouraged as it prevents theme customization. ```css .my-element { font-family: "Open Sans"; color: #0000ff; } ``` -------------------------------- ### Setting Environment Variables for Build Source: https://github.com/openedx/openedx-platform/blob/master/docs/decisions/0017-reimplement-asset-processing.rst Demonstrates how to set environment variables for the build process. These can be set for the entire build or specific steps like webpack. ```bash MY_ENV_VAR="my value" npm run build # Set for the whole build. MY_ENV_VAR="my value" npm run webpack # Set for just a single step, like webpack. ``` -------------------------------- ### Deprecated Navigation Template Example Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/navigation/navigation.html This is an example of the deprecated mako navigation template. It includes conditional logic for user authentication and language selection. ```html <%page expression_filter="h" args="online_help_token"/> <%namespace name='static' file='../static_content.html'/> <%namespace file='../main.html' import="login_query"/> <%! from django.urls import reverse from django.utils.translation import gettext as _ from lms.djangoapps.ccx.overrides import get_current_ccx from openedx.core.djangolib.markup import HTML, Text # App that handles subdomain specific branding from lms.djangoapps.branding import api as branding_api from openedx.core.djangoapps.lang_pref.api import header_language_selector_is_enabled, released_languages %> ## Provide a hook for themes to inject branding on top. <%block name="navigation_top" /> % if uses_bootstrap: <%include file="bootstrap/navbar-logo-header.html" args="online_help_token=online_help_token"/> % if user.is_authenticated: <%include file="navbar-authenticated.html" args="online_help_token=online_help_token"/> % else: <%include file="navbar-not-authenticated.html" args="online_help_token=online_help_token"/> % endif % else: <%include file="navbar-logo-header.html" args="online_help_token=online_help_token"/> % if user.is_authenticated: <%include file="navbar-authenticated.html" args="online_help_token=online_help_token"/> % else: <%include file="navbar-not-authenticated.html" args="online_help_token=online_help_token"/> % endif % if header_language_selector_is_enabled(): <% languages = released_languages() %> % if len(languages) > 1: 1. % if user.is_authenticated: % else: % endif ${"Choose Language"} % for language in languages: % if language[0] == LANGUAGE_CODE: ${language[1]} % else: ${language[1]} % endif % endfor % endif % endif % endif % if course: % endif % if settings.FEATURES.get('ENABLE_COOKIE_CONSENT', False): <%include file="../widgets/cookie-consent.html" /> % endif ``` -------------------------------- ### MFE Configuration API Response Example Source: https://github.com/openedx/openedx-platform/blob/master/lms/djangoapps/mfe_config_api/docs/decisions/0001-mfe-config-api.rst Example JSON response from the MFE configuration API, containing various configuration variables for an MFE. ```json { "BASE_URL": "https://name_of_mfe.example.com", "LANGUAGE_PREFERENCE_COOKIE_NAME": "example-language-preference", "CREDENTIALS_BASE_URL": "https://credentials.example.com", "DISCOVERY_API_BASE_URL": "https://discovery.example.com", "LMS_BASE_URL": "https://courses.example.com", "LOGIN_URL": "https://courses.example.com/login", "LOGOUT_URL": "https://courses.example.com/logout", "STUDIO_BASE_URL": "https://studio.example.com", "LOGO_URL": "https://courses.example.com/logo.png" } ``` -------------------------------- ### Example: Running a Single Python Unit Test File with Pytest Source: https://github.com/openedx/openedx-platform/blob/master/docs/concepts/testing/testing.rst This command demonstrates how to run tests from a single, specific Python unit test file, useful for quick checks during development. ```bash pytest xmodule/tests/test_stringify.py ``` -------------------------------- ### Initialize Facebook and AJAX Settings Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/certificates/_accomplishment-banner.html Initializes the Facebook SDK and sets up AJAX request headers for CSRF token authentication. This is typically done on document ready. ```html <%page expression_filter="h"/> <%! from django.utils.translation import gettext as _ from openedx.core.djangolib.js_utils import js_escaped_string %> <%namespace name='static' file='../static_content.html'/> <%block name="js_extra"> <%static:js group='certificates_wv'/> $(document).ready(function() { FaceBook.init({"facebook_app_id": '${facebook_app_id | n, js_escaped_string}'}); $.ajaxSetup({ headers: { 'X-CSRFToken': $.cookie('csrftoken') }, dataType: 'json' }); ``` -------------------------------- ### Install Production Dependencies for Asset Collection Source: https://github.com/openedx/openedx-platform/blob/master/docs/references/static-assets.rst Installs the necessary Python dependencies for collecting static assets on a production site. This command is distinct from asset building dependencies. ```bash pip install -r requirements/edx/base.txt -e . ``` -------------------------------- ### Build All Assets with NPM Source: https://github.com/openedx/openedx-platform/blob/master/docs/decisions/0017-reimplement-asset-processing.rst This command serves as a comprehensive wrapper for building all static assets. It ensures a clean installation of npm packages before initiating the build process. ```bash npm clean-install && npm run build ``` -------------------------------- ### Example Code Input Problem Source: https://github.com/openedx/openedx-platform/blob/master/xmodule/js/fixtures/codeinput_problem.html This is an example of a code input problem with a label and a placeholder for code. Users can write code in the editor and exit by pressing ESC then TAB or clicking outside. ```html
question label here
write some awesome code
Press ESC then TAB or click outside of the code editor to exit
``` -------------------------------- ### Initialize Manage User Factory Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/support/manage_user.html Initializes the ManageUserFactory with necessary user and URL data. Ensure 'username', 'user_support_url', and 'user_detail_url' are properly defined before this script runs. ```html <%page expression_filter="h"/> <%! from django.utils.translation import gettext as _ %> <%namespace name='static' file='../static_content.html'/> <%inherit file="../main.html" /> <%block name="js_extra"> <%static:require_module module_name="support/js/manage_user_factory" class_name="ManageUserFactory"> new ManageUserFactory({ user: '${username | n, js_escaped_string}', userSupportUrl: '${user_support_url | n, js_escaped_string}', userDetailUrl: '${user_detail_url | n, js_escaped_string}' }); <%endblock> <%block name="pagetitle"> ${_("Manage User")} <%endblock> <%block name="content"> ${_("Student Support: Manage User")} ===================================== <%endblock> ``` -------------------------------- ### Course Date and Status Logic Source: https://github.com/openedx/openedx-platform/blob/master/lms/templates/dashboard/_dashboard_course_listing.html Determines and formats the display string for course start or end dates based on enrollment status and course timeline. Handles 'Coming Soon', 'Started', and 'Ended' states. ```html ${course_overview.display_org_with_default} - ${course_overview.display_number_with_default} <% enrollment_date = course_overview.self_paced and enrollment and enrollment.created if course_overview.start_date_is_still_default: container_string = _("Coming Soon") course_date = None else: format = 'shortDate' dashboard_start_display = course_overview.dashboard_start_display if course_overview.has_ended(): container_string = _("Ended - {date}") course_date = course_overview.end elif course_overview.has_started(): container_string = _("Started - {date}") if enrollment_date and isinstance(dashboard_start_display, datetime.datetime): course_date = max(enrollment_date, dashboard_start_display) else: course_date = enrollment_date or dashboard_start_display elif course_overview.starts_within(days=5): container_string = _("Starts - {date}") course_date = dashboard_start_display format = 'defaultFormat' else: ## hasn't started yet container_string = _("Starts - {date}") course_date = dashboard_start_display endif endif %> ``` -------------------------------- ### Get Page Title Breadcrumbs Source: https://github.com/openedx/openedx-platform/blob/master/common/djangoapps/pipeline_mako/templates/static_content.html Returns the page title breadcrumbs. ```html <%def name="get_page_title_breadcrumbs(*args)"> <% return page_title_breadcrumbs(*args) %> ``` -------------------------------- ### Derive Mako Template Directories Source: https://github.com/openedx/openedx-platform/blob/master/lms/envs/docs/README.rst This example demonstrates deriving the Mako template directories list. It dynamically adjusts the DIRS setting based on ENABLE_COMPREHENSIVE_THEMING and other theme-related settings, ensuring proper template loading. ```python def make_mako_template_dirs(settings): """ Derives the final Mako template directories list from other settings. """ if settings.ENABLE_COMPREHENSIVE_THEMING: themes_dirs = get_theme_base_dirs_from_settings(settings.COMPREHENSIVE_THEME_DIRS) for theme in get_themes_unchecked(themes_dirs, settings.PROJECT_ROOT): if theme.themes_base_dir not in settings.MAKO_TEMPLATE_DIRS_BASE: settings.MAKO_TEMPLATE_DIRS_BASE.insert(0, theme.themes_base_dir) return settings.MAKO_TEMPLATE_DIRS_BASE TEMPLATES = [ { 'NAME': 'django', 'BACKEND': 'django.template.backends.django.DjangoTemplates', ... }, { 'NAME': 'mako', 'BACKEND': 'common.djangoapps.edxmako.backend.Mako', 'APP_DIRS': False, 'DIRS': Derived(make_mako_template_dirs), }, ] ``` -------------------------------- ### Get Template Path Source: https://github.com/openedx/openedx-platform/blob/master/common/djangoapps/pipeline_mako/templates/static_content.html Resolves and returns the path for a given template file. ```html <%def name="get_template_path(relative_path, **kwargs)"> <% return get_template_path(relative_path, **kwargs) %> ``` -------------------------------- ### Get Value with Default Source: https://github.com/openedx/openedx-platform/blob/master/common/djangoapps/pipeline_mako/templates/static_content.html Retrieves a named value, providing a default if not found. ```html <%def name="get_value(val_name, default=None, **kwargs)"> <% return get_value(val_name, default=default, **kwargs) %> ```