|
31 | 31 | FieldDataDeprecationWarning, |
32 | 32 | UserIdDeprecationWarning, |
33 | 33 | ) |
| 34 | +from xblock.xml import format_filepath, load_file, name_to_pathname |
34 | 35 |
|
35 | 36 | log = logging.getLogger(__name__) |
36 | 37 |
|
@@ -792,6 +793,24 @@ def add_block_as_child_node(self, block, node): |
792 | 793 | child = etree.SubElement(node, "unknown") |
793 | 794 | block.add_xml_to_node(child) |
794 | 795 |
|
| 796 | + def load_definition_xml(self, node, def_id): |
| 797 | + """ |
| 798 | + Load an XML definition for a block. |
| 799 | + This method can be overridden in different runtime environments. |
| 800 | +
|
| 801 | + Args: |
| 802 | + node: XML element containing attributes for definition loading |
| 803 | + def_id: Unique identifier for the definition being loaded |
| 804 | +
|
| 805 | + Returns: |
| 806 | + tuple: A tuple containing the loaded XML definition and the |
| 807 | + corresponding file path or identifier |
| 808 | + """ |
| 809 | + url_name = node.get('url_name') |
| 810 | + filepath = format_filepath(node.tag, name_to_pathname(url_name)) |
| 811 | + definition_xml = load_file(filepath, self.resources_fs, def_id) # pylint: disable=no-member |
| 812 | + return definition_xml, filepath |
| 813 | + |
795 | 814 | # Rendering |
796 | 815 |
|
797 | 816 | def render(self, block, view_name, context=None): |
|
0 commit comments