Skip to content

Commit

Permalink
MDL-54977 blocks_navigation: Use html_writer::random_id for id
Browse files Browse the repository at this point in the history
uniqid() may returns the same id for faster machines (seen on iis)
so use html_writer::random_id(), to ensure id is different and
navigation don't break
  • Loading branch information
jackdaniels79 authored and Rajesh Taneja committed Jul 13, 2016
1 parent 5a1728d commit 560cea8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion blocks/navigation/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected function navigation_node($items, $attrs=array(), $expansionlimit=null,
continue;
}

$id = $item->id ? $item->id : uniqid();
$id = $item->id ? $item->id : html_writer::random_id();
$content = $item->get_content();
$title = $item->get_title();
$ulattr = ['id' => $id . '_group', 'role' => 'group'];
Expand Down
2 changes: 1 addition & 1 deletion blocks/settings/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function navigation_node(navigation_node $node, $attrs=array(), $depth
}

$content = $this->output->render($item);
$id = $item->id ? $item->id : uniqid();
$id = $item->id ? $item->id : html_writer::random_id();
$ulattr = ['id' => $id . '_group', 'role' => 'group'];
$liattr = ['class' => [$item->get_css_type(), 'depth_'.$depth], 'tabindex' => '-1'];
$pattr = ['class' => ['tree_item'], 'role' => 'treeitem'];
Expand Down

0 comments on commit 560cea8

Please sign in to comment.