Skip to content
Browse files

MDL-40096 assign: Prevent js error because uniqid() is not unique.

Use html_writer::random_id instead because it incorporates a static counter.
  • Loading branch information...
1 parent b159b57 commit 9b378f3dc590f7f22c32c1c4414e4d640d376e4b @damyon damyon committed Dec 9, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 mod/assign/renderer.php
View
2 mod/assign/renderer.php
@@ -57,7 +57,7 @@ public function assign_files(context $context, $userid, $filearea, $component) {
* @return string
*/
public function render_assign_files(assign_files $tree) {
- $this->htmlid = 'assign_files_tree_'.uniqid();
+ $this->htmlid = html_writer::random_id('assign_files_tree');
$this->page->requires->js_init_call('M.mod_assign.init_tree', array(true, $this->htmlid));
$html = '<div id="'.$this->htmlid.'">';
$html .= $this->htmllize_tree($tree, $tree->dir);

0 comments on commit 9b378f3

Please sign in to comment.
Something went wrong with that request. Please try again.