diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index e08b3d3ab97..b6277cb1cf8 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -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 = []; diff --git a/lib/templates/action_menu_link.mustache b/lib/templates/action_menu_link.mustache index 0184d49bbe4..a57beb2e0fb 100644 --- a/lib/templates/action_menu_link.mustache +++ b/lib/templates/action_menu_link.mustache @@ -27,7 +27,14 @@ } }} {{^disabled}} - {{#icon}}{{#pix}}{{key}}, {{component}}, {{title}}{{/pix}}{{/icon}}{{#showtext}}{{{text}}}{{/showtext}} + + {{#icon}} + {{#pix}}{{key}}, {{component}}, {{title}}{{/pix}} + {{/icon}} + {{#showtext}} + {{{text}}} + {{/showtext}} + {{/disabled}} {{#disabled}} {{#icon}}{{#pix}}{{key}},{{component}},{{title}}{{/pix}}{{/icon}}{{{text}}} diff --git a/lib/templates/action_menu_trigger.mustache b/lib/templates/action_menu_trigger.mustache index 8a172c9dfad..9c009fcdb1d 100644 --- a/lib/templates/action_menu_trigger.mustache +++ b/lib/templates/action_menu_trigger.mustache @@ -95,16 +95,9 @@