Merge branch 'MDL-69262-master-2' of git://github.com/junpataleta/moodle into master
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 7 Sep 2020 21:42:45 +0000 (23:42 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 7 Sep 2020 21:42:45 +0000 (23:42 +0200)
lib/outputcomponents.php
lib/templates/action_menu_link.mustache
lib/templates/action_menu_trigger.mustache

index e08b3d3..b6277cb 100644 (file)
@@ -4682,6 +4682,12 @@ class action_menu_link extends action_link implements renderable {
      */
     public $actionmenu = null;
 
+    /**
+     * The number of instances of this action menu link (and its subclasses).
+     * @var int
+     */
+    protected static $instance = 1;
+
     /**
      * Constructs the object.
      *
@@ -4705,10 +4711,8 @@ class action_menu_link extends action_link implements renderable {
      * @return stdClass
      */
     public function export_for_template(renderer_base $output) {
-        static $instance = 1;
-
         $data = parent::export_for_template($output);
-        $data->instance = $instance++;
+        $data->instance = self::$instance++;
 
         // Ignore what the parent did with the attributes, except for ID and class.
         $data->attributes = [];
index 0184d49..a57beb2 100644 (file)
     }
 }}
 {{^disabled}}
-    <a href="{{url}}" class="aabtn {{classes}}" {{#attributes}}{{name}}={{#quote}}{{value}}{{/quote}} {{/attributes}}{{#showtext}}aria-labelledby="actionmenuaction-{{instance}}"{{/showtext}}>{{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{#showtext}}<span class="menu-action-text" id="actionmenuaction-{{instance}}">{{{text}}}</span>{{/showtext}}</a>
+    <a href="{{url}}" class="{{$actionmenulinkclasses}}aabtn {{classes}}{{/actionmenulinkclasses}}" {{#attributes}}{{name}}={{#quote}}{{value}}{{/quote}} {{/attributes}}{{#showtext}}aria-labelledby="actionmenuaction-{{instance}}"{{/showtext}}>
+        {{#icon}}
+            {{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}
+        {{/icon}}
+        {{#showtext}}
+            <span class="menu-action-text" id="actionmenuaction-{{instance}}">{{{text}}}</span>
+        {{/showtext}}
+    </a>
 {{/disabled}}
 {{#disabled}}
     <span class="currentlink" role="menuitem">{{#icon}}{{#pix}}{{key}},{{component}},{{title}}{{/pix}}{{/icon}}{{{text}}}</span>
index 8a172c9..9c009fc 100644 (file)
         <div class="dropdown-menu dropdown-menu-right {{classes}}"{{#attributes}} {{name}}="{{value}}"{{/attributes}}>
             {{#items}}
                 {{#actionmenulink}}
-                    <a href="{{url}}" class="dropdown-item {{classes}}" {{#attributes}}{{name}}={{#quote}}{{value}}{{/quote}} {{/attributes}}{{#showtext}}aria-labelledby="actionmenuaction-{{instance}}"{{/showtext}}>
-                        {{#icon}}
-                            {{#pix}}{{key}},{{component}},{{title}}{{/pix}}
-                        {{/icon}}
-                        {{#showtext}}
-                        <span class="menu-action-text" id="actionmenuaction-{{instance}}">
-                            {{{text}}}
-                        </span>
-                        {{/showtext}}
-                    </a>
+                    {{< core/action_menu_link}}
+                        {{$actionmenulinkclasses}}dropdown-item {{classes}}{{/actionmenulinkclasses}}
+                    {{/ core/action_menu_link}}
                 {{/actionmenulink}}
                 {{#actionmenufiller}}
                     <div class="dropdown-divider" role="presentation"><span class="filler">&nbsp;</span></div>