Skip to content

Commit

Permalink
MDL-16089 adding easier access to current module instance data in mod…
Browse files Browse the repository at this point in the history
…edit forms
  • Loading branch information
skodak committed Jul 3, 2009
1 parent 49427ed commit 9a10598
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions course/moodleform_mod.php
Expand Up @@ -10,6 +10,8 @@
*
*/
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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 9a10598

Please sign in to comment.