MDL-59713 forms: prevent php warning when 'optional' option is missing
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 29 Aug 2017 18:12:41 +0000 (20:12 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 29 Aug 2017 18:12:41 +0000 (20:12 +0200)
lib/form/datetimeselector.php

index fb2d0eb..7a6644e 100644 (file)
@@ -228,7 +228,7 @@ class MoodleQuickForm_date_time_selector extends MoodleQuickForm_group {
                 }
                 break;
             case 'createElement':
-                if ($arg[2]['optional']) {
+                if (isset($arg[2]['optional']) && $arg[2]['optional']) {
                     // When using the function addElement, rather than createElement, we still
                     // enter this case, making this check necessary.
                     if ($this->_usedcreateelement) {