From d6d13338e31896034f69228a396d8cbdce81a97c Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Fri, 27 Oct 2017 12:16:21 +0400 Subject: Grinding of the final class --- classes/editform.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'classes/editform.php') diff --git a/classes/editform.php b/classes/editform.php index 5e75050..89786bf 100644 --- a/classes/editform.php +++ b/classes/editform.php @@ -47,7 +47,7 @@ class service_edit_form extends moodleform { } /** - * Unpacks data for display. + * Preparing data before displaying. * * @param object $record */ @@ -64,17 +64,18 @@ class service_edit_form extends moodleform { */ protected function definition() { $mform =& $this->_form; + $size = array("size" => 60); /* Form heading */ $mform->addElement("header", "editserviceheader", new lang_string("service", "webservice")); /* Name of the service */ - $mform->addElement("text", "title", new lang_string("name", "moodle"), array("size" => 60)); + $mform->addElement("text", "title", new lang_string("name", "moodle"), $size); $mform->addRule("title", null, "required"); $mform->setType("title", PARAM_NOTAGS); /* Callback address */ - $mform->addElement("text", "url", new lang_string("url", "moodle"), array("size" => 60)); + $mform->addElement("text", "url", new lang_string("url", "moodle"), $size); $mform->addRule("url", null, "required"); $mform->setType("url", PARAM_URL); @@ -85,11 +86,12 @@ class service_edit_form extends moodleform { $mform->setAdvanced("enable"); /* Token */ - $mform->addElement("text", "token", new lang_string("token", "webservice"), array("size" => 60)); + $mform->addElement("text", "token", new lang_string("token", "webservice"), $size); $mform->setType("token", PARAM_NOTAGS); /* Content type */ - $mform->addElement("select", "type", "Content type", array("json" => "application/json", "x-www-form-urlencoded" => "application/x-www-form-urlencoded")); + $contenttype = array("json" => "application/json", "x-www-form-urlencoded" => "application/x-www-form-urlencoded"); + $mform->addElement("select", "type", "Content type", $contenttype); $mform->setAdvanced("type"); /* Form heading */ -- cgit v1.2.3