在moodle模块中插入一行代码的正确方法是什么?

在moodle模块中插入一行代码的正确方法是什么?,moodle,Moodle,我有一个想法,就是需要在\mod\lti目录下的locallib.php中添加一行代码。('custom_user'=>$user->username,) 有没有正确的方法?看看插件,它们似乎是为了添加全新的功能,而不仅仅是修补单个现有的代码。只是看看模块——以前从未遇到过 有自定义参数,但它们看起来像文字值 我会说把代码放进去是可以的。虽然我可能会在mod前后添加//CUSTOM。谢谢,但我正在寻找在Moodle中完成补丁的半官方方式。可能是某种或某种方式也会指示或阻止维护过度清除补丁? $r

我有一个想法,就是需要在\mod\lti目录下的locallib.php中添加一行代码。('custom_user'=>$user->username,)


有没有正确的方法?看看插件,它们似乎是为了添加全新的功能,而不仅仅是修补单个现有的代码。

只是看看模块——以前从未遇到过

有自定义参数,但它们看起来像文字值


我会说把代码放进去是可以的。虽然我可能会在mod前后添加//CUSTOM。

谢谢,但我正在寻找在Moodle中完成补丁的半官方方式。可能是某种或某种方式也会指示或阻止维护过度清除补丁?
$requestparams = array(
        'resource_link_id' => $instance->id,
        'resource_link_title' => $instance->name,
        'resource_link_description' => $instance->intro,
        'user_id' => $USER->id,
        'roles' => $role,
        'context_id' => $course->id,
        'context_label' => $course->shortname,
        'context_title' => $course->fullname,
        'launch_presentation_locale' => current_language()
    );


$requestparams = array(
        'resource_link_id' => $instance->id,
        'resource_link_title' => $instance->name,
        'resource_link_description' => $instance->intro,
        'user_id' => $USER->id,

        'custom_user' => $USER->username,

        'roles' => $role,
        'context_id' => $course->id,
        'context_label' => $course->shortname,
        'context_title' => $course->fullname,
        'launch_presentation_locale' => current_language()
    );