Problem/Motivation

This was handled through hook_init() within each course object type provider module.

API changes

The context setting was moved into the course object, and invoked from parent in a more structured way:

  • Each module that wishes to provide course context handlers must define a context callback in hook_course_handlers() (see @return documentation on that hook)
  • The context handler callback is expected to return query parameters suitable for course_determine_context() (see @param documentation on that function)
  • See examples in course extension modules, included in Course (example: Course book)

Comments

djdevin’s picture

Just wanted to note that this is difficult, moving context functionality into each course object means we have to load every single class at init, which defeats the point of auto/lazy loading.

scottrigby’s picture

I think we determined we're now going to define a context callback in our new hook_course_handlers()

djdevin’s picture

scottrigby’s picture

Also see 2e2bf1ea1f002239f42adde2fa7f66efd052473d:

  • course_init() is where context gets set
  • course_context() is Course's self-defined context handler callback, which sets context while on the course node
scottrigby’s picture

Status: Needs review » Fixed

Updated issue summary with resolution, and API changes.

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Update issue summary with resolution

  • Commit 02953d9 on 6.x-1.x, 7.x-1.x, 7.x-1.x-fieldable-entities, course-object-entity-view authored by scottrigby, committed by djdevin:
    Issue #1517296: Added new course context hook (basically, a glorified...
  • Commit 2e2bf1e on 6.x-1.x, 7.x-1.x, 7.x-1.x-fieldable-entities, course-object-entity-view by djdevin:
    Issue #1517296: add course context callback, Issue #1647480: by djdevin...
  • Commit aa2e808 on 6.x-1.x, 7.x-1.x, 7.x-1.x-fieldable-entities, course-object-entity-view authored by scottrigby, committed by djdevin:
    Issue #1517296: use context callbacks in modules