Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 52... Línea 52...
52
        // Is the select multiple?
52
        // Is the select multiple?
53
        $multiple = $this->field->hasAttribute('multiple');
53
        $multiple = $this->field->hasAttribute('multiple');
Línea 54... Línea 54...
54
 
54
 
55
        // Here we select the option(s).
55
        // Here we select the option(s).
-
 
56
        if ($multiple) {
-
 
57
            // Is the value empty?
-
 
58
            if (empty(trim($value))) {
-
 
59
                // Reset selection to nothing.
-
 
60
                $this->field->setValue([]);
-
 
61
                return;
-
 
62
            }
56
        if ($multiple) {
63
 
57
            // Split and decode values. Comma separated list of values allowed. With valuable commas escaped with backslash.
64
            // Split and decode values. Comma separated list of values allowed. With valuable commas escaped with backslash.
58
            $options = preg_replace('/\\\,/', ',',  preg_split('/(?<!\\\),/', trim($value)));
65
            $options = preg_replace('/\\\,/', ',',  preg_split('/(?<!\\\),/', trim($value)));
59
            // This is a multiple select, let's pass the multiple flag after first option.
66
            // This is a multiple select, let's pass the multiple flag after first option.
60
            $afterfirstoption = false;
67
            $afterfirstoption = false;