From 0a9bc0cdfe24a9bba11196319f294d26eee850d7 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Tue, 4 Aug 2020 09:50:25 +0800 Subject: [PATCH] MDL-69401 book: Limit character length in chapter title --- mod/book/edit_form.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/book/edit_form.php b/mod/book/edit_form.php index 9a8cbf4d776..e681e563096 100644 --- a/mod/book/edit_form.php +++ b/mod/book/edit_form.php @@ -55,9 +55,11 @@ class book_chapter_edit_form extends moodleform { ); } - $mform->addElement('text', 'title', get_string('chaptertitle', 'mod_book'), array('size'=>'30')); + $mform->addElement('text', 'title', get_string('chaptertitle', 'mod_book'), + ['size' => '30', 'maxlength' => '255']); $mform->setType('title', PARAM_RAW); $mform->addRule('title', null, 'required', null, 'client'); + $mform->addRule('title', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); $mform->addElement('advcheckbox', 'subchapter', get_string('subchapter', 'mod_book'), $disabledmsg);