Skip to content

Commit 268468a

Browse files
committed
Reduce the table field name length for the recently added flavour settings as they were too long for legacy Moodle versions
1 parent da60e3e commit 268468a

File tree

5 files changed

+46
-46
lines changed

5 files changed

+46
-46
lines changed

classes/form/flavour_edit_form.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ public function definition() {
189189
THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_BOTTOM, ];
190190
$backgroundimagepositionselect = $mform->addElement(
191191
'select',
192-
'look_backgroundimageposition',
192+
'look_backgroundimagepos',
193193
get_string('flavoursbackgroundimageposition', 'theme_boost_union'),
194194
$backgroundimagepositionoptions,
195195
);
196-
$mform->setType('look_backgroundimageposition', PARAM_TEXT);
196+
$mform->setType('look_backgroundimagepos', PARAM_TEXT);
197197
$backgroundimagepositionselect->setSelected([THEME_BOOST_UNION_SETTING_SELECT_NOCHANGE]);
198-
$mform->addHelpButton('look_backgroundimageposition', 'flavoursbackgroundimageposition', 'theme_boost_union');
198+
$mform->addHelpButton('look_backgroundimagepos', 'flavoursbackgroundimageposition', 'theme_boost_union');
199199

200200
// Add brand colors heading.
201201
$context = new \stdClass();
@@ -290,13 +290,13 @@ public function definition() {
290290
$this->check_slasharguments_warning($mform);
291291
$mform->addElement(
292292
'theme_boost_union_colorpicker',
293-
'look_activityiconcolor'.$purpose,
293+
'look_aicol'.$purpose,
294294
get_string('flavoursactivityiconcolor'.$purpose, 'theme_boost_union'),
295295
['id' => 'colourpicker-activityiconcolor'.$purpose]);
296-
$mform->setType('look_activityiconcolor'.$purpose, PARAM_TEXT);
297-
$mform->addRule('look_activityiconcolor'.$purpose, get_string('validateerror', 'admin'),
296+
$mform->setType('look_aicol'.$purpose, PARAM_TEXT);
297+
$mform->addRule('look_aicol'.$purpose, get_string('validateerror', 'admin'),
298298
'theme_boost_union_colorpicker_rule');
299-
$mform->addHelpButton('look_activityiconcolor'.$purpose, 'flavoursactivityiconcolor'.$purpose, 'theme_boost_union');
299+
$mform->addHelpButton('look_aicol'.$purpose, 'flavoursactivityiconcolor'.$purpose, 'theme_boost_union');
300300
}
301301

302302
// Add navbar heading.

db/install.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@
2020
<FIELD NAME="look_logocompact" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
2121
<FIELD NAME="look_favicon" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
2222
<FIELD NAME="look_backgroundimage" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
23-
<FIELD NAME="look_backgroundimageposition" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
23+
<FIELD NAME="look_backgroundimagepos" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
2424
<FIELD NAME="look_rawscss" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
2525
<FIELD NAME="look_rawscsspre" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
2626
<FIELD NAME="look_brandcolor" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
2727
<FIELD NAME="look_bootstrapcolorsuccess" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
2828
<FIELD NAME="look_bootstrapcolorinfo" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
2929
<FIELD NAME="look_bootstrapcolorwarning" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
3030
<FIELD NAME="look_bootstrapcolordanger" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
31-
<FIELD NAME="look_activityiconcoloradministration" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
32-
<FIELD NAME="look_activityiconcolorassessment" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
33-
<FIELD NAME="look_activityiconcolorcollaboration" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
34-
<FIELD NAME="look_activityiconcolorcommunication" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
35-
<FIELD NAME="look_activityiconcolorcontent" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
36-
<FIELD NAME="look_activityiconcolorinteractivecontent" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
37-
<FIELD NAME="look_activityiconcolorinterface" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
31+
<FIELD NAME="look_aicoladministration" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
32+
<FIELD NAME="look_aicolassessment" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
33+
<FIELD NAME="look_aicolcollaboration" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
34+
<FIELD NAME="look_aicolcommunication" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
35+
<FIELD NAME="look_aicolcontent" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
36+
<FIELD NAME="look_aicolinteractivecontent" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
37+
<FIELD NAME="look_aicolinterface" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
3838
<FIELD NAME="look_navbarcolor" TYPE="char" LENGTH="32" NOTNULL="false" SEQUENCE="false"/>
3939
</FIELDS>
4040
<KEYS>

db/upgrade.php

+24-24
Original file line numberDiff line numberDiff line change
@@ -410,67 +410,67 @@ function xmldb_theme_boost_union_upgrade($oldversion) {
410410
// Define table theme_boost_union_flavours to be altered.
411411
$table = new xmldb_table('theme_boost_union_flavours');
412412

413-
// Define field look_backgroundimageposition to be added to theme_boost_union_flavours.
414-
$field = new xmldb_field('look_backgroundimageposition', XMLDB_TYPE_CHAR, '32', null, null, null, null,
413+
// Define field look_backgroundimagepos to be added to theme_boost_union_flavours.
414+
$field = new xmldb_field('look_backgroundimagepos', XMLDB_TYPE_CHAR, '32', null, null, null, null,
415415
'look_backgroundimage');
416416

417-
// Conditionally launch add field look_backgroundimageposition.
417+
// Conditionally launch add field look_backgroundimagepos.
418418
if (!$dbman->field_exists($table, $field)) {
419419
$dbman->add_field($table, $field);
420420
}
421421

422-
// Define field look_activityiconcoloradministration to be added to theme_boost_union_flavours.
423-
$field = new xmldb_field('look_activityiconcoloradministration', XMLDB_TYPE_CHAR, '32', null, null, null, null);
422+
// Define field look_aicoladministration to be added to theme_boost_union_flavours.
423+
$field = new xmldb_field('look_aicoladministration', XMLDB_TYPE_CHAR, '32', null, null, null, null);
424424

425-
// Conditionally launch add field look_activityiconcoloradministration.
425+
// Conditionally launch add field look_aicoladministration.
426426
if (!$dbman->field_exists($table, $field)) {
427427
$dbman->add_field($table, $field);
428428
}
429429

430-
// Define field look_activityiconcolorasessment to be added to theme_boost_union_flavours.
431-
$field = new xmldb_field('look_activityiconcolorasessment', XMLDB_TYPE_CHAR, '32', null, null, null, null);
430+
// Define field look_aicolassessment to be added to theme_boost_union_flavours.
431+
$field = new xmldb_field('look_aicolassessment', XMLDB_TYPE_CHAR, '32', null, null, null, null);
432432

433-
// Conditionally launch add field look_activityiconcolorasessment.
433+
// Conditionally launch add field look_aicolassessment.
434434
if (!$dbman->field_exists($table, $field)) {
435435
$dbman->add_field($table, $field);
436436
}
437437

438-
// Define field look_activityiconcolorcollaboration to be added to theme_boost_union_flavours.
439-
$field = new xmldb_field('look_activityiconcolorcollaboration', XMLDB_TYPE_CHAR, '32', null, null, null, null);
438+
// Define field look_aicolcollaboration to be added to theme_boost_union_flavours.
439+
$field = new xmldb_field('look_aicolcollaboration', XMLDB_TYPE_CHAR, '32', null, null, null, null);
440440

441-
// Conditionally launch add field look_activityiconcolorcollaboration.
441+
// Conditionally launch add field look_aicolcollaboration.
442442
if (!$dbman->field_exists($table, $field)) {
443443
$dbman->add_field($table, $field);
444444
}
445445

446-
// Define field look_activityiconcolorcommunication to be added to theme_boost_union_flavours.
447-
$field = new xmldb_field('look_activityiconcolorcommunication', XMLDB_TYPE_CHAR, '32', null, null, null, null);
446+
// Define field look_aicolcommunication to be added to theme_boost_union_flavours.
447+
$field = new xmldb_field('look_aicolcommunication', XMLDB_TYPE_CHAR, '32', null, null, null, null);
448448

449-
// Conditionally launch add field look_activityiconcolorcommunication.
449+
// Conditionally launch add field look_aicolcommunication.
450450
if (!$dbman->field_exists($table, $field)) {
451451
$dbman->add_field($table, $field);
452452
}
453453

454-
// Define field look_activityiconcolorcontent to be added to theme_boost_union_flavours.
455-
$field = new xmldb_field('look_activityiconcolorcontent', XMLDB_TYPE_CHAR, '32', null, null, null, null);
454+
// Define field look_aicolcontent to be added to theme_boost_union_flavours.
455+
$field = new xmldb_field('look_aicolcontent', XMLDB_TYPE_CHAR, '32', null, null, null, null);
456456

457-
// Conditionally launch add field look_activityiconcolorcontent.
457+
// Conditionally launch add field look_aicolcontent.
458458
if (!$dbman->field_exists($table, $field)) {
459459
$dbman->add_field($table, $field);
460460
}
461461

462-
// Define field look_activityiconcolorinteractivecontent to be added to theme_boost_union_flavours.
463-
$field = new xmldb_field('look_activityiconcolorinteractivecontent', XMLDB_TYPE_CHAR, '32', null, null, null, null);
462+
// Define field look_aicolinteractivecontent to be added to theme_boost_union_flavours.
463+
$field = new xmldb_field('look_aicolinteractivecontent', XMLDB_TYPE_CHAR, '32', null, null, null, null);
464464

465-
// Conditionally launch add field look_activityiconcolorinteractivecontent.
465+
// Conditionally launch add field look_aicolinteractivecontent.
466466
if (!$dbman->field_exists($table, $field)) {
467467
$dbman->add_field($table, $field);
468468
}
469469

470-
// Define field look_activityiconcolorinterface to be added to theme_boost_union_flavours.
471-
$field = new xmldb_field('look_activityiconcolorinterface', XMLDB_TYPE_CHAR, '32', null, null, null, null);
470+
// Define field look_aicolinterface to be added to theme_boost_union_flavours.
471+
$field = new xmldb_field('look_aicolinterface', XMLDB_TYPE_CHAR, '32', null, null, null, null);
472472

473-
// Conditionally launch add field look_activityiconcolorinterface.
473+
// Conditionally launch add field look_aicolinterface.
474474
if (!$dbman->field_exists($table, $field)) {
475475
$dbman->add_field($table, $field);
476476
}

lib.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ function theme_boost_union_get_pre_scss($theme) {
313313
if ($flavourid != null) {
314314
// Get color setting from flavour.
315315
$activityiconcolorflavour = theme_boost_union_get_flavour_config_item_for_flavourid($flavourid,
316-
'look_activityiconcolor'.$purpose);
316+
'look_aicol'.$purpose);
317317

318318
// If a flavour color is set.
319319
if (!empty($activityiconcolorflavour)) {
@@ -487,7 +487,7 @@ function theme_boost_union_get_extra_scss($theme) {
487487
}
488488
// And if a background image position is set in the flavour.
489489
$backgroundimageposition = theme_boost_union_get_flavour_config_item_for_flavourid($flavourid,
490-
'look_backgroundimageposition');
490+
'look_backgroundimagepos');
491491
if ($backgroundimageposition != null && $backgroundimageposition != THEME_BOOST_UNION_SETTING_SELECT_NOCHANGE) {
492492
// Set the background position in the SCSS code, adhering the fact that we must not overwrite the login page
493493
// background image position again.

tests/behat/theme_boost_union_flavourssettings_look.feature

+5-5
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ Feature: Configuring the theme_boost_union plugin on the "Flavours" page, applyi
204204
And I expand all fieldsets
205205
And I set the field "Title" to "My shiny new flavour"
206206
And I upload "theme/boost_union/tests/fixtures/login_bg1.png" file to "Background image" filemanager
207-
And I set the field "look_backgroundimageposition" to "<position>"
207+
And I set the field "look_backgroundimagepos" to "<position>"
208208
And I select "Yes" from the "Apply to course categories" singleselect
209209
And I click on ".form-autocomplete-downarrow" "css_element" in the "#fitem_id_applytocategories_ids" "css_element"
210210
And I click on "Cat 1" item in the autocomplete list
@@ -231,7 +231,7 @@ Feature: Configuring the theme_boost_union plugin on the "Flavours" page, applyi
231231
And I expand all fieldsets
232232
And I set the field "Title" to "My shiny new flavour"
233233
And I upload "theme/boost_union/tests/fixtures/login_bg1.png" file to "Background image" filemanager
234-
And I set the field "look_backgroundimageposition" to "<position>"
234+
And I set the field "look_backgroundimagepos" to "<position>"
235235
And I select "Yes" from the "Apply to course categories" singleselect
236236
And I click on ".form-autocomplete-downarrow" "css_element" in the "#fitem_id_applytocategories_ids" "css_element"
237237
And I click on "Cat 1" item in the autocomplete list
@@ -259,7 +259,7 @@ Feature: Configuring the theme_boost_union plugin on the "Flavours" page, applyi
259259
And I expand all fieldsets
260260
And I set the field "Title" to "My shiny new flavour"
261261
And I upload "theme/boost_union/tests/fixtures/login_bg1.png" file to "Background image" filemanager
262-
And I set the field "look_backgroundimageposition" to "No change"
262+
And I set the field "look_backgroundimagepos" to "No change"
263263
And I select "Yes" from the "Apply to course categories" singleselect
264264
And I click on ".form-autocomplete-downarrow" "css_element" in the "#fitem_id_applytocategories_ids" "css_element"
265265
And I click on "Cat 1" item in the autocomplete list
@@ -444,7 +444,7 @@ Feature: Configuring the theme_boost_union plugin on the "Flavours" page, applyi
444444
And I should see "Create flavour" in the "#page-header h1" "css_element"
445445
And I expand all fieldsets
446446
And I set the field "Title" to "My shiny new flavour"
447-
And I set the field "look_activityiconcolor<purposename>" to "<colorhex>"
447+
And I set the field "look_aicol<purposename>" to "<colorhex>"
448448
And I select "Yes" from the "Apply to course categories" singleselect
449449
And I click on ".form-autocomplete-downarrow" "css_element" in the "#fitem_id_applytocategories_ids" "css_element"
450450
And I click on "Cat 1" item in the autocomplete list
@@ -484,7 +484,7 @@ Feature: Configuring the theme_boost_union plugin on the "Flavours" page, applyi
484484
And I should see "Create flavour" in the "#page-header h1" "css_element"
485485
And I expand all fieldsets
486486
And I set the field "Title" to "My shiny new flavour"
487-
And I set the field "look_activityiconcolor<purposename>" to "<colorhex>"
487+
And I set the field "look_aicol<purposename>" to "<colorhex>"
488488
And I select "Yes" from the "Apply to course categories" singleselect
489489
And I click on ".form-autocomplete-downarrow" "css_element" in the "#fitem_id_applytocategories_ids" "css_element"
490490
And I click on "Cat 1" item in the autocomplete list

0 commit comments

Comments
 (0)