Merge branch 'MDL-54837-master' of git://github.com/marinaglancy/moodle
This commit is contained in:
@@ -128,6 +128,9 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete {
|
||||
*/
|
||||
public function onQuickFormEvent($event, $arg, &$caller) {
|
||||
if ($event === 'createElement') {
|
||||
if (!is_array($arg[2])) {
|
||||
$arg[2] = [];
|
||||
}
|
||||
$arg[2] += array('itemtype' => '', 'component' => '');
|
||||
}
|
||||
return parent::onQuickFormEvent($event, $arg, $caller);
|
||||
|
||||
@@ -43,8 +43,17 @@ class tagareacollection extends \core\output\inplace_editable {
|
||||
* @param \stdClass $tagarea
|
||||
*/
|
||||
public function __construct($tagarea) {
|
||||
if (!empty($tagarea->locked)) {
|
||||
// If the tag collection for the current tag area is locked, display the
|
||||
// name of the collection without possibility to edit it.
|
||||
$tagcoll = \core_tag_collection::get_by_id($tagarea->tagcollid);
|
||||
parent::__construct('core_tag', 'tagareacollection', $tagarea->id, false,
|
||||
\core_tag_collection::display_name($tagcoll), $tagarea->tagcollid);
|
||||
return;
|
||||
}
|
||||
|
||||
$tagcollections = \core_tag_collection::get_collections_menu(true);
|
||||
$editable = (count($tagcollections) > 1) && empty($tagarea->locked) &&
|
||||
$editable = (count($tagcollections) > 1) &&
|
||||
has_capability('moodle/tag:manage', context_system::instance());
|
||||
$areaname = core_tag_area::display_name($tagarea->component, $tagarea->itemtype);
|
||||
$edithint = new lang_string('edittagcollection', 'core_tag');
|
||||
|
||||
+1
-1
@@ -1297,7 +1297,7 @@ class core_tag_tag {
|
||||
require_once($CFG->dirroot . '/' . ltrim($tagarea->callbackfile, '/'));
|
||||
}
|
||||
$callback = $tagarea->callback;
|
||||
return $callback($this, $exclusivemode, $fromctx, $ctx, $rec, $page);
|
||||
return call_user_func_array($callback, [$this, $exclusivemode, $fromctx, $ctx, $rec, $page]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user