feat: adds openedx-filter hook to the child blocks of VerticalBlock
This commit adds a openedx-filters hook to the VerticalBlock XBlock before rendering of it's children. This allows Open edX plugins to customize the presentation of specific blocks based on the context.
This commit is contained in:
@@ -181,3 +181,7 @@ well as the trigger location in this same repository.
|
||||
* - `DashboardRenderStarted <https://github.com/openedx/openedx-filters/blob/main/openedx_filters/learning/filters.py#L354>`_
|
||||
- org.openedx.learning.dashboard.render.started.v1
|
||||
- `2022-06-14 <https://github.com/eduNEXT/edx-platform/blob/master/common/djangoapps/student/views/dashboard.py#L878>`_
|
||||
|
||||
* - `VerticalChildRenderStarted <https://github.com/openedx/openedx-filters/blob/main/openedx_filters/learning/filters.py#L427>`_
|
||||
- org.openedx.learning.veritical_child_block.render.started.v1
|
||||
- `2022-08-18 <https://github.com/openedx/edx-platform/blob/master/xmodule/vertical_block.py#L122>`_
|
||||
|
||||
@@ -746,7 +746,7 @@ openedx-calc==3.0.1
|
||||
# via -r requirements/edx/base.in
|
||||
openedx-events==0.11.1
|
||||
# via -r requirements/edx/base.in
|
||||
openedx-filters==0.7.0
|
||||
openedx-filters==0.8.0
|
||||
# via
|
||||
# -r requirements/edx/base.in
|
||||
# lti-consumer-xblock
|
||||
|
||||
@@ -974,7 +974,7 @@ openedx-calc==3.0.1
|
||||
# via -r requirements/edx/testing.txt
|
||||
openedx-events==0.11.1
|
||||
# via -r requirements/edx/testing.txt
|
||||
openedx-filters==0.7.0
|
||||
openedx-filters==0.8.0
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# lti-consumer-xblock
|
||||
|
||||
@@ -921,7 +921,7 @@ openedx-calc==3.0.1
|
||||
# via -r requirements/edx/base.txt
|
||||
openedx-events==0.11.1
|
||||
# via -r requirements/edx/base.txt
|
||||
openedx-filters==0.7.0
|
||||
openedx-filters==0.8.0
|
||||
# via
|
||||
# -r requirements/edx/base.txt
|
||||
# lti-consumer-xblock
|
||||
|
||||
@@ -13,6 +13,7 @@ from lxml import etree
|
||||
from web_fragments.fragment import Fragment
|
||||
from xblock.core import XBlock # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xblock.fields import Boolean, Scope
|
||||
from openedx_filters.learning.filters import VerticalBlockChildRenderStarted
|
||||
from xmodule.mako_module import MakoTemplateBlockBase
|
||||
from xmodule.progress import Progress
|
||||
from xmodule.seq_module import SequenceFields
|
||||
@@ -117,6 +118,13 @@ class VerticalBlock(
|
||||
child_block_context['wrap_xblock_data'] = {
|
||||
'mark-completed-on-view-after-delay': complete_on_view_delay
|
||||
}
|
||||
|
||||
# .. filter_implemented_name: VerticalBlockChildRenderStarted
|
||||
# .. filter_type: org.openedx.learning.vertical_block_child.render.started.v1
|
||||
child, child_block_context = VerticalBlockChildRenderStarted.run_filter(
|
||||
block=child, context=child_block_context
|
||||
)
|
||||
|
||||
rendered_child = child.render(view, child_block_context)
|
||||
fragment.add_fragment_resources(rendered_child)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user