Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-16842

Adding group element in function lib/formslib.php/repeat_elements()


    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.8.7
    • 2.0
    • Forms Library
    • None

      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 @@
      for ($i=0; $i<$repeats; $i++) {
      foreach ($elementobjs as $elementobj){

      • $elementclone = clone($elementobj);
        + $elementclone = fullclone($elementobj);
        $name = $elementclone->getName();
        if (!empty($name)){
        Other repeated elements functions should also be tested.
        The work on question units will be used to test if other code improvments are necessary.

            jamiesensei Jamie Pratt
            ppichet Pierre Pichet
            0 Vote for this issue
            1 Start watching this issue


                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.