Repository navigation
Fix the select option labels and HTML encoded settings in the back end - #37
Merged
Merged
Conversation
- Do not add HTML to the field option labels; Contao escapes option labels, so the <span> and the JSON encoded SQL definition were shown as text. The SQL definition is now appended as readable plain text. - Decode the HTML encoded field separator, field enclosure and the values of the "transform values" mapping (Contao 5 stores back end input encoded) - Escape the confirm message and the app URL for JavaScript in the import template - Fix the case of the ImportFromCsv callback class in the DCA Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jb7ViNYJwLjr2Y34g8aAoK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the broken select options in the back end, plus the other encoding problems I found while checking the bundle.
Field option labels (screenshot bug)
optionsCbGetTableColumns()returned labels likefirstname <span class="ifcb-sql-descr">[{"type":"string",…}]</span>. Contao escapes option labels, so the select (choices) showed the raw HTML and JSON. These options are used by:matchByskipValidationFieldsfield_namecolumns of theselectedFieldsandmapValuesrow wizardsThe labels are now plain text:
firstname [string(255), default: '']id [integer, unsigned, autoincrement]title [varchar(255) NOT NULL default '']The new
formatSqlDefinition()method turns the array SQL definition into readable text.Other encoding issues
mapValues): In Contao 5 back end input is stored HTML encoded. A value likeA&Bwas stored asA&B, so it never matched the raw CSV value, andtransform_towas written to the record still encoded.decodeEntities.mb_strtolower/mb_strtoupper(umlauts) and no longer emit undefined-key warnings.MountAppAjaxControllerand the header lookup in the data container.fieldSeparatornow usesuseRawRequestData, likefieldEnclosurealready did. Otherwise characters like&would be stored as&and fail themaxlengthof 1.import.html.twig: The confirm message and the app URL/token are inside JavaScript strings but were HTML-escaped or|raw. They now use|e('js'). Previously an apostrophe in a translation broke the JavaScript.ImportFromCSV::classis changed toImportFromCsv::class. The callback class name was in the wrong case.Tests
New
ImportFromCsvTestfor the plain-text label. CI is green on Contao 5.7.14, 5.7.15 and 6.0.4.Suggested release: 5.5.1.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Jb7ViNYJwLjr2Y34g8aAoK
Generated by Claude Code