Fixes renderers.php for the missing 'numsections' issue
There is an outstanding pull request to assign variables that seem to have been lost from core:
That pull request only adds them in one place, I believe there are at least two functions within renderers.php which would require this change if done at that level.
I am not sure if doing it repeatedly within functions is the best approach but it would be acceptable to do it that way unless they could be assigned when the theme loaded as opposed to being applied by multiple functions.
Comments (5)
-
-
-
reporter Yes that is the case, it is missing from 3.3 so we need to put it in the theme for now.
-
I've looked at the code in the pull request and I've done a solution in renderers.php partially using this. I've created a "get" method in the trait single_section_page for number of sections and then called that in the two places where it was previously referencing $course->numsections. It's also expandable should this information be needed by anything else. By doing this we can remove reference to $course->numsections . It could cause further confusion going forward if we keep using it and think this approach maybe more futureproof? Will check this into my branch for review.
-
- changed status to resolved
Fix
#728. ->numsections reference issue fix.→ <<cset da487918fc00>>
Tested on 3.2 and 3.3. Please review.
- Log in to comment
Just looking at this. The issue appears (I believe) on 3.3 where the numsections class variable no longer exists. See screenshot below.![numsections issue issue 728.png](https://bitbucket.org/repo/XE9aXM/images/2152610624-numsections%20issue%20issue%20728.png)