Remove the "Return to" appended to Link to acitivity

Remove the "Return to" appended to Link to acitivity

Walid Hammad -
回帖数:2

Hello there,

Linking to activity at the end of a lesson module is awesome feature. However it appends "Return to" as well as "Go to" as you can see in the screen shot below.

How do I get rid of that? This is moodle 2.0 installation and I have access to the php files but no experience where to do what.

Thanks in advance,

Walid

平均分:Useful (1)
回复Walid Hammad

Re: Remove the "Return to" appended to Link to acitivity

Chris Collman -
Documentation writers的头像

Hi Walid,

This is a minor bug, but a bug that I added to Tracker (MDL 24401).   Another similar one is after you create a "Content page" the save button says "Save question page" (addaquestionpage string).

I would say there are 2 ways for you to fix this.  One via the PHP code and the other by editing the string via the site language pack.

The quickest fix: I would suggest playing with the site administration>language>language customizations  and checking out the mod>lesson strings.  First time I have dug into this interface in 2.0, different but easier to find the modules strings.   Anyway, "activitylinkname" in demo.moodle.net says Go to: {$a} , I changed that to just {$a}.   "returnto" is probably the string that is repeated 2 times in the php code.  So I changed that to check it to "Wowie I want to go to:"  It is, so I suggest changing that string to "Go to: ", unless of course you like my "Wowie" or longer "Wowie Zowie" 微笑

Here is the before (1) and after (2) in demo.moodle.net in a one page lesson.  The pink string is the activitylinkname and the yellow is the returnto string.

Thanks for the  post.

附件 Lesson end of page links.png
回复Chris Collman

Re: Remove the "Return to" appended to Link to acitivity

Walid Hammad -

Thank you Chris!

I am interested in the php solution as I would want to completely remove return to phrase just from the activity link but not from returning to course.

So i found the code that causes this to be in mod/lesson/locallib.php

----------------------

return html_writer::link(new moodle_url('/mod/'.$modname.'/view.php', array('id'=>$this->properties->activitylink)),
get_string('returnto', 'lesson', get_string('activitylinkname', 'lesson', $instancename)),
array('class'=>'centerpadded lessonbutton standardbutton'));

----------------------

I don't seem to understand truely how the arguments for the function get_string work, because putting any other string in place of 'returnto' would result in the link appearing as [/[ lesson ]/] rather than Go to: Activity name

Anyhow, Thanks again 微笑

Cheers,

Walid