mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
Merge branch 'MDL-75788-master' of https://github.com/lameze/moodle
This commit is contained in:
commit
ff871829c5
5 changed files with 44 additions and 17 deletions
|
@ -1324,6 +1324,11 @@ EOD;
|
|||
[$data['categoryid']]) + 1;
|
||||
}
|
||||
|
||||
if ($data['datatype'] === 'menu' && isset($data['param1'])) {
|
||||
// Convert new lines to the proper character.
|
||||
$data['param1'] = str_replace('\n', "\n", $data['param1']);
|
||||
}
|
||||
|
||||
// Defaults for other values.
|
||||
$defaults = [
|
||||
'description' => '',
|
||||
|
|
|
@ -577,5 +577,12 @@ class testing_generator_test extends \advanced_testcase {
|
|||
$field7 = $generator->create_custom_profile_field(
|
||||
['datatype' => 'checkbox', 'shortname' => 'areyousure', 'name' => 'Are you sure?']);
|
||||
$this->assertEquals(0, $field7->defaultdata);
|
||||
|
||||
// Check setting options for menu using \n work as expected.
|
||||
$field8 = $generator->create_custom_profile_field([
|
||||
'datatype' => 'menu', 'shortname' => 'cuisine', 'name' => 'Cuisine', 'param1' => 'French\nChinese\nLebanese',
|
||||
'defaultdata' => 'Chinese'
|
||||
]);
|
||||
$this->assertEquals("French\nChinese\nLebanese", $field8->param1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue