MDL-55327 mod_lesson: better convert back to plain response_editor

This commit is contained in:
Eloy Lafuente (stronk7) 2016-09-22 19:17:47 +02:00
parent dd193ba2ea
commit 0fba5b440d

View File

@ -120,9 +120,10 @@ class lesson_page_type_matching extends lesson_page {
// Check for duplicate response format.
$duplicateresponse = array();
if (is_array($properties->response_editor[0])) {
foreach ($properties->response_editor as $response) {
$duplicateresponse[] = $response['text'];
if (is_array($properties->response_editor) && // If there are response_editors to iterate.
is_array(reset($properties->response_editor))) { // And they come split into text & format array.
foreach ($properties->response_editor as $response) { // Iterate over all them.
$duplicateresponse[] = $response['text']; // Picking the text only. This pagetype is that way.
}
$properties->response_editor = $duplicateresponse;
}