From 9a105989fec7e833fafbccb8a910153301439698 Mon Sep 17 00:00:00 2001
From: skodak <skodak>
Date: Fri, 3 Jul 2009 13:33:03 +0000
Subject: [PATCH] MDL-16089 adding easier access to current module instance
 data in modedit forms

---
 course/moodleform_mod.php | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/course/moodleform_mod.php b/course/moodleform_mod.php
index e4a3b6b8ae..cdf354777b 100644
--- a/course/moodleform_mod.php
+++ b/course/moodleform_mod.php
@@ -10,6 +10,8 @@ if (!empty($CFG->enablecompletion) or !empty($CFG->enableavailability)) {
  *
  */
 class moodleform_mod extends moodleform {
+    /** Current data */
+    protected $current;
     /**
      * Instance of the module that is being updated. This is the id of the {prefix}{modulename}
      * record. Can be used in form definition. Will be "" if this is an 'add' form and not an
@@ -47,10 +49,11 @@ class moodleform_mod extends moodleform {
     /** current context, course or module depends if already exists*/
     protected $context;
 
-    function moodleform_mod($instance, $section, $cm, $course) {
-        $this->_instance = $instance;
-        $this->_section = $section;
-        $this->_cm = $cm;
+    function moodleform_mod($current, $section, $cm, $course) {
+        $this->current   = $current;
+        $this->_instance = $current->instance;
+        $this->_section  = $section;
+        $this->_cm       = $cm;
         if ($this->_cm) {
             $this->context = get_context_instance(CONTEXT_MODULE, $this->_cm->id);
         } else {
-- 
2.39.5