Closed
Detect legacy HTML in content_builder value and offer one-click migration to a slice#20
Conversation
Closed
Copilot
AI
changed the title
[WIP] Add functionality to detect HTML content in yform value
Detect legacy HTML in content_builder value and offer one-click migration to a slice
May 28, 2026
Member
|
@copilot ist es fertig? |
Author
Ja, die Änderungen aus der PR-Beschreibung sind committet (siehe |
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.
When a
content_builderYForm field already contains classic HTML (e.g. migrated from a legacytextarea/WYSIWYG field), the value was silently dropped becauseparseValue()returned[]for any non-JSON input. The field should instead recognize HTML, expose it in a CKE5/TinyMCE editor using the admin-configured profile, and let the editor migrate it into a Content Builder slice.Changes
pages/settings.php, lang files) – new addon configslegacy_editor(none|cke5|tinymce) andlegacy_profile. Per-field overrides exposed viagetDefinitions().rex_yform_value_content_builder::getTemplateVars()– when the raw value is non-empty and not a valid JSON array, the original string is forwarded to the template aslegacy_htmlalong with the resolvedlegacy_editor/legacy_profile.ytemplates/bootstrap/value.content_builder.tpl.php– iflegacy_htmlis present and a legacy editor is configured, renders aalert-warningbar with a "Convert to Content Builder" button plus a<textarea>carrying thecke5-editor/tiny-editorclass anddata-profile=…attribute. While legacy mode is active, the slices container, the add-element dropdown and the hidden JSON input are suppressed; the textarea uses the YForm field name directly so plain saves preserve the value.assets/content-builder.jsinitLegacyEditors()boots the appropriate editor via the existingcke5_init/tiny_inithelpers.migrateLegacyHtml()reads the current editor content (tinymce.get(id), thenckeditors[id]for CKE5, fallback to textarea value), destroys the editor instance, removes the legacy block, callsaddSlice(..., 'starter_text', …)and pre-fillsdata-slice-datawith{ text: html }, then re-emits the hidden JSON input.assets/content-builder.css– minor flex layout for the notice bar.Detection logic
Notes for review
starter_text/ fieldtext. If a project replaces that element it should still work as long as the field key remainstext; otherwise we may want to make the target configurable.data-profile(matching howCke5Field/TinyMceFieldrender their textareas), so existing profile handling on the addon side applies unchanged.