MDL-82392 blocks: consistent cleaning of block instance names.
This commit is contained in:
@@ -75,15 +75,12 @@ class block extends context {
|
||||
* @return string the human readable context name.
|
||||
*/
|
||||
public function get_context_name($withprefix = true, $short = false, $escape = true) {
|
||||
global $DB, $CFG;
|
||||
global $DB;
|
||||
|
||||
$name = '';
|
||||
if ($blockinstance = $DB->get_record('block_instances', array('id' => $this->_instanceid))) {
|
||||
global $CFG;
|
||||
require_once("$CFG->dirroot/blocks/moodleblock.class.php");
|
||||
require_once("$CFG->dirroot/blocks/$blockinstance->blockname/block_$blockinstance->blockname.php");
|
||||
$blockname = "block_$blockinstance->blockname";
|
||||
if ($blockobject = new $blockname()) {
|
||||
$blockobject = block_instance($blockinstance->blockname);
|
||||
if ($blockobject) {
|
||||
if ($withprefix) {
|
||||
$name = get_string('block').': ';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user