mirror of
https://github.com/moodle/moodle.git
synced 2025-04-19 07:25:30 +02:00
MDL-54128 mod_lti: Add help for custom LTI tools in activity picker
This commit is contained in:
parent
65cbefc403
commit
f418d89957
@ -1289,6 +1289,14 @@ function get_module_metadata($course, $modnames, $sectionreturn = null) {
|
||||
// otherwise append the link url to the module name.
|
||||
$item->name = (count($items) == 1 &&
|
||||
$item->link->out() === $defaultmodule->link->out()) ? $modname : $modname . ':' . $item->link;
|
||||
|
||||
// If the module provides the helptext property, append it to the help text to match the look and feel
|
||||
// of the default course modules.
|
||||
if (isset($item->help) && isset($item->helplink)) {
|
||||
$linktext = get_string('morehelp');
|
||||
$item->help .= html_writer::tag('div',
|
||||
$OUTPUT->doc_link($item->helplink, $linktext, true), array('class' => 'helpdoclink'));
|
||||
}
|
||||
$modlist[$course->id][$modname][$item->name] = $item;
|
||||
}
|
||||
$return += $modlist[$course->id][$modname];
|
||||
|
@ -290,6 +290,7 @@ External tool activities differ from URL resources in a few ways:
|
||||
* External tools support reading, updating, and deleting grades associated with the activity instance
|
||||
* External tool configurations create a trust relationship between your site and the tool provider, allowing secure communication between them';
|
||||
$string['modulename_link'] = 'mod/lti/view';
|
||||
$string['modulename_shortcut_link'] = 'mod/lti/view/custom';
|
||||
$string['modulenameplural'] = 'External tools';
|
||||
$string['modulenamepluralformatted'] = 'LTI Instances';
|
||||
$string['name'] = 'Name';
|
||||
|
@ -206,7 +206,8 @@ function lti_delete_instance($id) {
|
||||
*
|
||||
* @param stdClass $defaultitem default item that would be added to the activity chooser if this callback was not present.
|
||||
* It has properties: archetype, name, title, help, icon, link
|
||||
* @return array An array of aliases for this activity. Each element is an object with same list of properties as $defaultitem.
|
||||
* @return array An array of aliases for this activity. Each element is an object with same list of properties as $defaultitem,
|
||||
* plus an additional property, helplink.
|
||||
* Properties title and link are required
|
||||
**/
|
||||
function lti_get_shortcuts($defaultitem) {
|
||||
|
@ -1126,7 +1126,7 @@ function lti_get_types_for_add_instance() {
|
||||
*
|
||||
* @param int $courseid The id of the course to retieve types for
|
||||
* @param int $sectionreturn section to return to for forming the URLs
|
||||
* @return array Array of lti types. Each element is object with properties: name, title, icon, help, link
|
||||
* @return array Array of lti types. Each element is object with properties: name, title, icon, help, helplink, link
|
||||
*/
|
||||
function lti_get_configured_types($courseid, $sectionreturn = 0) {
|
||||
global $OUTPUT;
|
||||
@ -1138,6 +1138,11 @@ function lti_get_configured_types($courseid, $sectionreturn = 0) {
|
||||
$type->modclass = MOD_CLASS_ACTIVITY;
|
||||
$type->name = 'lti_type_' . $ltitype->id;
|
||||
$type->title = $ltitype->name;
|
||||
$trimmeddescription = trim($ltitype->description);
|
||||
if ($trimmeddescription != '') {
|
||||
$type->help = $trimmeddescription;
|
||||
$type->helplink = get_string('modulename_shortcut_link', 'lti');
|
||||
}
|
||||
if (empty($ltitype->icon)) {
|
||||
$type->icon = $OUTPUT->pix_icon('icon', '', 'lti', array('class' => 'icon'));
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user