From 13b6b5dce83992b3c63f1184d8ab0322224a6eef Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Thu, 19 Mar 2020 20:34:24 +0100 Subject: [PATCH 1/2] MDL-58964 navigation: Add class attributes to Boost flat navigation --- theme/boost/templates/flat_navigation.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/theme/boost/templates/flat_navigation.mustache b/theme/boost/templates/flat_navigation.mustache index bd70e4ac8be..e6fef272ec3 100644 --- a/theme/boost/templates/flat_navigation.mustache +++ b/theme/boost/templates/flat_navigation.mustache @@ -66,7 +66,7 @@ {{/showdivider}} {{#action}}
  • - +
    {{#icon.pix}} @@ -82,7 +82,7 @@ {{/action}} {{^action}}
  • -
    +
    {{#icon.pix}} From d4737c214730f74af8e8f280e83390263be62cda Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Mon, 23 Mar 2020 21:33:47 +0100 Subject: [PATCH 2/2] MDL-58964 navigation: Reindex array when element is removed --- lib/navigationlib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 13feb3bbc0d..410e9acd8db 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -544,7 +544,11 @@ class navigation_node implements renderable { if (in_array($class, $this->classes)) { $key = array_search($class,$this->classes); if ($key!==false) { + // Remove the class' array element. unset($this->classes[$key]); + // Reindex the array to avoid failures when the classes array is iterated later in mustache templates. + $this->classes = array_values($this->classes); + return true; } }