MDL-84763 customfield: increase size of category/field name fields.
Allows for more flexibility for multi-lingual sites using filtered text.
This commit is contained in:
@@ -51,16 +51,24 @@ class field_config_form extends \core_form\dynamic_form {
|
||||
|
||||
$mform->addElement('header', '_commonsettings', get_string('commonsettings', 'core_customfield'));
|
||||
|
||||
$mform->addElement('text', 'name', get_string('fieldname', 'core_customfield'), 'size="50"');
|
||||
$mform->addElement('text', 'name', get_string('fieldname', 'core_customfield'), [
|
||||
'size' => 50,
|
||||
'maxlength' => 1333,
|
||||
]);
|
||||
$mform->addRule('name', null, 'required', null, 'client');
|
||||
$mform->addRule('name', get_string('maximumchars', '', 1333), 'maxlength', 1333, 'client');
|
||||
$mform->setType('name', PARAM_TEXT);
|
||||
|
||||
// Accepted values for 'shortname' would follow [a-z0-9_] pattern,
|
||||
// but we are accepting any PARAM_TEXT value here,
|
||||
// and checking [a-zA-Z0-9_] pattern in validation() function to throw an error when needed.
|
||||
$mform->addElement('text', 'shortname', get_string('fieldshortname', 'core_customfield'), 'size=20');
|
||||
$mform->addElement('text', 'shortname', get_string('fieldshortname', 'core_customfield'), [
|
||||
'size' => 20,
|
||||
'maxlength' => 100,
|
||||
]);
|
||||
$mform->addHelpButton('shortname', 'shortname', 'core_customfield');
|
||||
$mform->addRule('shortname', null, 'required', null, 'client');
|
||||
$mform->addRule('shortname', get_string('maximumchars', '', 100), 'maxlength', 100, 'client');
|
||||
$mform->setType('shortname', PARAM_TEXT);
|
||||
|
||||
$desceditoroptions = $handler->get_description_text_options();
|
||||
|
||||
@@ -43,6 +43,7 @@ function core_customfield_inplace_editable($itemtype, $itemid, $newvalue) {
|
||||
throw new moodle_exception('nopermissionconfigure', 'core_customfield');
|
||||
}
|
||||
$newvalue = clean_param($newvalue, PARAM_TEXT);
|
||||
$newvalue = core_text::substr($newvalue, 0, 1333);
|
||||
$handler->rename_category($category, $newvalue);
|
||||
return \core_customfield\api::get_category_inplace_editable($category, true);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="lib/db" VERSION="20250902" COMMENT="XMLDB file for core Moodle tables"
|
||||
<XMLDB PATH="lib/db" VERSION="20250922" COMMENT="XMLDB file for core Moodle tables"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
@@ -4282,7 +4282,7 @@
|
||||
<TABLE NAME="customfield_category" COMMENT="core_customfield category table">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="400" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="1333" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
|
||||
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
|
||||
@@ -4306,7 +4306,7 @@
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||
<FIELD NAME="shortname" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="400" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="name" TYPE="char" LENGTH="1333" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="type" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false"/>
|
||||
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
||||
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
|
||||
|
||||
@@ -2295,5 +2295,24 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2025091600.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2025092200.00) {
|
||||
// Changing precision of field name on table customfield_category to (1333).
|
||||
$table = new xmldb_table('customfield_category');
|
||||
$field = new xmldb_field('name', XMLDB_TYPE_CHAR, '1333', null, XMLDB_NOTNULL, null, null, 'id');
|
||||
|
||||
// Launch change of precision for field name.
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
// Changing precision of field name on table customfield_field to (1333).
|
||||
$table = new xmldb_table('customfield_field');
|
||||
$field = new xmldb_field('name', XMLDB_TYPE_CHAR, '1333', null, XMLDB_NOTNULL, null, null, 'shortname');
|
||||
|
||||
// Launch change of precision for field name.
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2025092200.00);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2025091900.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2025092200.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
$release = '5.1dev+ (Build: 20250919)'; // Human-friendly version name
|
||||
|
||||
Reference in New Issue
Block a user