mirror of
https://github.com/moodle/moodle.git
synced 2025-05-12 19:25:35 +02:00
MDL-79610 courseformat: Fix availability restrictions rendering
When duplicating a course module, availability restrictions was not rendering properly. That happened because 'editing' was not being exported for template for a single course module. This patch adds 'editing' to the cm exported data.
This commit is contained in:
parent
6374475dc3
commit
d94b14d396
@ -264,3 +264,16 @@ Feature: edit_availability
|
|||||||
And I should not see "Content"
|
And I should not see "Content"
|
||||||
And I should see "Collapse all"
|
And I should see "Collapse all"
|
||||||
And I should not see "Expand all"
|
And I should not see "Expand all"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Edit activity availability button is shown after duplicating an activity
|
||||||
|
# Setting a restriction up
|
||||||
|
Given I am on the "MyForum" "forum activity editing" page logged in as teacher1
|
||||||
|
And I expand all fieldsets
|
||||||
|
And I press "Add restriction..."
|
||||||
|
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
||||||
|
When I press "Save and return to course"
|
||||||
|
And I turn editing mode on
|
||||||
|
And I duplicate "MyForum" activity
|
||||||
|
# Testing edit restrictions link
|
||||||
|
Then "Edit restrictions" "link" should exist in the "MyForum (copy)" "core_availability > Activity availability"
|
||||||
|
@ -107,6 +107,8 @@ class cm implements named_templatable, renderable {
|
|||||||
* @return stdClass data context for a mustache template
|
* @return stdClass data context for a mustache template
|
||||||
*/
|
*/
|
||||||
public function export_for_template(renderer_base $output): stdClass {
|
public function export_for_template(renderer_base $output): stdClass {
|
||||||
|
global $PAGE;
|
||||||
|
|
||||||
$mod = $this->mod;
|
$mod = $this->mod;
|
||||||
$displayoptions = $this->displayoptions;
|
$displayoptions = $this->displayoptions;
|
||||||
|
|
||||||
@ -118,6 +120,7 @@ class cm implements named_templatable, renderable {
|
|||||||
'textclasses' => $displayoptions['textclasses'],
|
'textclasses' => $displayoptions['textclasses'],
|
||||||
'classlist' => [],
|
'classlist' => [],
|
||||||
'cmid' => $mod->id,
|
'cmid' => $mod->id,
|
||||||
|
'editing' => $PAGE->user_is_editing(),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Add partial data segments.
|
// Add partial data segments.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user