Merge branch 'MDL-51267-master' of git://github.com/lameze/moodle

This commit is contained in:
David Monllao
2016-04-19 11:53:22 +08:00
4 changed files with 9 additions and 12 deletions
+5 -2
View File
@@ -777,9 +777,10 @@ abstract class moodleform_mod extends moodleform {
* Add an editor for an activity's introduction field.
*
* @param null $customlabel Override default label for editor
* @param array $attributes add custom attributes for the editor, it sets rows size to 10 (default) to text editor.
* @throws coding_exception
*/
protected function standard_intro_elements($customlabel=null) {
protected function standard_intro_elements($customlabel=null, $attributes = array()) {
global $CFG;
$required = $CFG->requiremodintro;
@@ -787,7 +788,9 @@ abstract class moodleform_mod extends moodleform {
$mform = $this->_form;
$label = is_null($customlabel) ? get_string('moduleintro') : $customlabel;
$mform->addElement('editor', 'introeditor', $label, array('rows' => 10), array('maxfiles' => EDITOR_UNLIMITED_FILES,
$attributes['rows'] = !empty($attributes['rows']) ? $attributes['rows'] : 10;
$mform->addElement('editor', 'introeditor', $label, $attributes, array('maxfiles' => EDITOR_UNLIMITED_FILES,
'noclean' => true, 'context' => $this->context, 'subdirs' => true));
$mform->setType('introeditor', PARAM_RAW); // no XSS prevention here, users must be trusted
if ($required) {
+1 -5
View File
@@ -55,11 +55,7 @@ class mod_resource_mod_form extends moodleform_mod {
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$this->standard_intro_elements();
//-------------------------------------------------------
$mform->addElement('header', 'contentsection', get_string('contentheader', 'resource'));
$mform->setExpanded('contentsection');
$this->standard_intro_elements(null, array('rows' => 5));
$filemanager_options = array();
$filemanager_options['accepted_types'] = '*';
+2
View File
@@ -3,6 +3,8 @@ information provided here is intended especially for developers.
=== 3.1 ===
* A new parameter ($attributes) has been added to standard_intro_elements() on course/moodleform_mod.php. The
purpose of this parameter is allow developers to pass an array with custom attributes to the text editor.
* Old /mod/MODULENAME/pix/icon.gif and enrol/paypal/pix/icon.gif GIF icons have been removed. Please use pix_icon
renderable instead.
* Callback get_types() is deprecated, instead activity modules can define callback get_shortcuts().
+1 -5
View File
@@ -45,14 +45,10 @@ class mod_url_mod_form extends moodleform_mod {
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$this->standard_intro_elements();
//-------------------------------------------------------
$mform->addElement('header', 'content', get_string('contentheader', 'url'));
$mform->addElement('url', 'externalurl', get_string('externalurl', 'url'), array('size'=>'60'), array('usefilepicker'=>true));
$mform->setType('externalurl', PARAM_RAW_TRIMMED);
$mform->addRule('externalurl', null, 'required', null, 'client');
$mform->setExpanded('content');
$this->standard_intro_elements(null, array('rows' => 5));
//-------------------------------------------------------
$mform->addElement('header', 'optionssection', get_string('appearance'));