Problem/Motivation

lms_scheduling needs per-course open dates for lessons. Lessons can be shared between courses, so the date belongs on the course–lesson reference, which makes it a lesson reference parameter. Right now only the lesson handler defines lesson parameters, and LmsReferenceParametersForm drops any data keys it doesn't know about when it saves.

The course navigation has no alter point for lesson items, so lms_scheduling can't disable links to lessons that aren't open yet.

Proposed resolution

  • Invoke lesson parameter alters (info, form elements, submitted values) in LmsReferenceParametersForm after the lesson handler. Values of third-party elements are taken from the form state before the submit alter runs.
  • Support #display_callback (a callable definition) on parameter elements, for values that aren't scalar.
  • Invoke a module and theme alter at the end of CourseNavBlockBuilder::buildLesson().

API changes

  • hook_lms_lesson_parameter_info_alter(), hook_lms_lesson_parameters_form_alter(), hook_lms_lesson_parameters_submit_alter(), hook_lms_course_navigation_lesson_alter()
  • #display_callback on parameter elements

Issue fork lms-3640991

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

graber created an issue. See original summary.

graber’s picture

Issue summary: View changes

graber’s picture

Issue summary: View changes