mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
moodle_url MDL-20674 Added a method to allow the dev to set the anchor attribute of a moodle_url
This commit is contained in:
parent
7e0b616a4a
commit
13b0b27172
@ -548,6 +548,17 @@ class moodle_url {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the anchor for the URI (the bit after the hash)
|
||||
* @param string $anchor
|
||||
*/
|
||||
public function set_anchor($anchor) {
|
||||
// Match the anchor against the NMTOKEN spec
|
||||
if (preg_match('#[a-zA-Z\_\:][a-zA-Z0-9\_\-\.\:]*#', $anchor)) {
|
||||
$this->fragment = $anchor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user