mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-71051 core_user: move user profile edit field form to classes
This commit is contained in:
parent
60b95cd46f
commit
4a159a0947
@ -36,7 +36,6 @@ require_once($CFG->libdir . '/form/datetimeselector.php');
|
||||
// Used to test the user datetime profile field.
|
||||
require_once($CFG->dirroot . '/user/profile/lib.php');
|
||||
require_once($CFG->dirroot . '/user/profile/definelib.php');
|
||||
require_once($CFG->dirroot . '/user/profile/index_field_form.php');
|
||||
|
||||
/**
|
||||
* Unit tests for the calendar type system.
|
||||
@ -275,10 +274,10 @@ class core_calendar_type_testcase extends advanced_testcase {
|
||||
$formdata['param2'] = $date['inputmaxyear'];
|
||||
|
||||
// Mock submitting this.
|
||||
field_form::mock_submit($formdata);
|
||||
\core_user\form\profile_field_form::mock_submit($formdata);
|
||||
|
||||
// Create the user datetime form.
|
||||
$form = new field_form(null, 'datetime');
|
||||
$form = new \core_user\form\profile_field_form(null, 'datetime');
|
||||
|
||||
// Get the data from the submission.
|
||||
$submissiondata = $form->get_data();
|
||||
|
@ -22,9 +22,11 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); // It must be included from a Moodle page.
|
||||
}
|
||||
namespace core_user\form;
|
||||
|
||||
use profile_define_base;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
require_once($CFG->dirroot.'/lib/formslib.php');
|
||||
|
||||
@ -34,7 +36,7 @@ require_once($CFG->dirroot.'/lib/formslib.php');
|
||||
* @copyright 2007 onwards Shane Elliot {@link http://pukunui.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class field_form extends moodleform {
|
||||
class profile_field_form extends \moodleform {
|
||||
|
||||
/** @var profile_define_base $field */
|
||||
public $field;
|
@ -575,8 +575,7 @@ function profile_edit_field($id, $datatype, $redirect) {
|
||||
$field->description = clean_text($field->description, $field->descriptionformat);
|
||||
$field->description = array('text' => $field->description, 'format' => $field->descriptionformat, 'itemid' => 0);
|
||||
|
||||
require_once($CFG->dirroot.'/user/profile/index_field_form.php');
|
||||
$fieldform = new field_form(null, $field->datatype);
|
||||
$fieldform = new \core_user\form\profile_field_form(null, $field->datatype);
|
||||
|
||||
// Convert the data format for.
|
||||
if (is_array($fieldform->editors())) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user