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 = [];