-
Improvement
-
Resolution: Fixed
-
Minor
-
2.0
-
None
-
MOODLE_20_STABLE
-
MOODLE_18_STABLE
Adding group element to the function lib/formslib.php/repeat_elements() would improve its flexibility.
Developping an improved question units interface MDL-4474 shows the limit of the actual function.
The group element sructure is more complex than the single element (i.e. text ) and the first difficulty is related to the creation of the multiple elements step
Actual code use clone() to create the copy.
Internal element are not copied and all the cloned group element refers to the original internal element.
clone()should be replaced by fullclone().
RCS file: /cvsroot/moodle/moodle/lib/formslib.php,v
retrieving revision 1.160
diff -u -r1.160 formslib.php
— formslib.php 23 Sep 2008 14:45:58 -0000 1.160
+++ formslib.php 9 Oct 2008 04:59:26 -0000
@@ -736,7 +736,7 @@
$mform->setConstants(array($repeathiddenname=>$repeats));
for ($i=0; $i<$repeats; $i++) {
foreach ($elementobjs as $elementobj){
- $elementclone = clone($elementobj);
+ $elementclone = fullclone($elementobj);
$name = $elementclone->getName();
if (!empty($name)){
$elementclone->setName($name."[$i]");
Other repeated elements functions should also be tested.
The work on question units will be used to test if other code improvments are necessary.
- will help resolve
-
MDL-4474 measurement units and quizzes
- Closed