$module['id'] = $cm->id;
$module['name'] = external_format_string($cm->name, $modcontext->id);
$module['instance'] = $cm->instance;
+ $module['contextid'] = $modcontext->id;
$module['modname'] = (string) $cm->modname;
$module['modplural'] = (string) $cm->modplural;
$module['modicon'] = $cm->get_icon_url()->out(false);
'url' => new external_value(PARAM_URL, 'activity url', VALUE_OPTIONAL),
'name' => new external_value(PARAM_RAW, 'activity module name'),
'instance' => new external_value(PARAM_INT, 'instance id', VALUE_OPTIONAL),
+ 'contextid' => new external_value(PARAM_INT, 'Activity context id.', VALUE_OPTIONAL),
'description' => new external_value(PARAM_RAW, 'activity description', VALUE_OPTIONAL),
'visible' => new external_value(PARAM_INT, 'is the module visible', VALUE_OPTIONAL),
'uservisible' => new external_value(PARAM_BOOL, 'Is the module visible for the user?',
array('noclean' => true, 'para' => false, 'filter' => false));
$this->assertEquals($formattedtext, $module['description']);
$this->assertEquals($forumcm->instance, $module['instance']);
+ $this->assertEquals(context_module::instance($forumcm->id)->id, $module['contextid']);
$this->assertContains('1 unread post', $module['afterlink']);
$this->assertFalse($module['noviewlink']);
$this->assertNotEmpty($module['description']); // Module showdescription is on.
array('noclean' => true, 'para' => false, 'filter' => false));
$this->assertEquals($formattedtext, $module['description']);
$this->assertEquals($labelcm->instance, $module['instance']);
+ $this->assertEquals(context_module::instance($labelcm->id)->id, $module['contextid']);
$this->assertTrue($module['noviewlink']);
$this->assertNotEmpty($module['description']); // Label always prints the description.
$testexecuted = $testexecuted + 1;