1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 09:55:33 +02:00
This commit is contained in:
Huong Nguyen 2024-11-28 11:58:50 +07:00 committed by Jun Pataleta
commit 711e58f1a4
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7

@ -14,24 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Customfields text field plugin
*
* @package customfield_text
* @copyright 2018 Daniel Neis Araujo <daniel@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace customfield_text;
defined('MOODLE_INTERNAL') || die;
use core_customfield\api;
/**
* Class data
*
* @package customfield_text
* @package customfield_text
* @copyright 2018 Daniel Neis Araujo <daniel@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -105,8 +93,8 @@ class data_controller extends \core_customfield\data_controller {
$link = $this->get_field()->get_configdata_property('link');
if ($link) {
$url = new \moodle_url(str_replace('$$', $this->get_value(), $link));
$linktarget = $this->get_field()->get_configdata_property('linktarget');
$url = str_replace('$$', urlencode($this->get_value()), $link);
$attributes = $linktarget ? ['target' => $linktarget] : [];
$value = \html_writer::link($url, $value, $attributes);
}