Merge branch 'MDL-68315-master' of https://github.com/kabalin/moodle
authorSara Arjona <sara@moodle.com>
Mon, 4 May 2020 08:37:17 +0000 (10:37 +0200)
committerSara Arjona <sara@moodle.com>
Mon, 4 May 2020 08:37:17 +0000 (10:37 +0200)
1  2 
lib/form/course.php

diff --combined lib/form/course.php
@@@ -70,7 -70,7 +70,7 @@@ class MoodleQuickForm_course extends Mo
       *                       'requiredcapabilities' - array of capabilities. Uses ANY to combine them.
       *                       'limittoenrolled' - boolean Limits to enrolled courses.
       *                       'includefrontpage' - boolean Enables the frontpage to be selected.
-      *                       'onlywithcompletion' - only courses where completion is enabled
+      *                       'onlywithcompletion' - boolean Limits to courses where completion is enabled.
       */
      public function __construct($elementname = null, $elementlabel = null, $attributes = array()) {
          if (!is_array($attributes)) {
              $attributes['data-includefrontpage'] = SITEID;
              unset($attributes['includefrontpage']);
          }
-         if (!empty($options['onlywithcompletion'])) {
-             $validattributes['data-onlywithcompletion'] = 1;
+         if (!empty($attributes['onlywithcompletion'])) {
+             $attributes['data-onlywithcompletion'] = 1;
+             unset($attributes['onlywithcompletion']);
          }
  
          parent::__construct($elementname, $elementlabel, array(), $attributes);
          $coursestofetch = array();
  
          foreach ($values as $onevalue) {
 -            if ((!$this->optionExists($onevalue)) &&
 +            if ($onevalue && !$this->optionExists($onevalue) &&
                      ($onevalue !== '_qf__force_multiselect_submission')) {
                  array_push($coursestofetch, $onevalue);
              }