-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New Type field in Dynamic Web Content. #14759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new "Type" field in Dynamic Web Content to differentiate between text and HTML content and adds validations and UI behavior based on the selected type.
- Added a toggleContentEditor function in dynamicContent.js to initialize or destroy CKEditor instances based on the type field.
- Updated CKEditor toolbar configuration in 1a.content.js to use a globally defined MauticVars.maxButtons array.
Reviewed Changes
Copilot reviewed 5 out of 23 changed files in this pull request and generated no comments.
File | Description |
---|---|
app/bundles/DynamicContentBundle/Assets/js/dynamicContent.js | Added toggleContentEditor to handle CKEditor initialization/destroying. |
app/bundles/CoreBundle/Assets/js/1a.content.js | Refactored toolbar configuration to use the global MauticVars.maxButtons. |
Files not reviewed (18)
- app/bundles/DynamicContentBundle/Config/config.php: Language not supported
- app/bundles/DynamicContentBundle/DynamicContent/TypeList.php: Language not supported
- app/bundles/DynamicContentBundle/Entity/DynamicContent.php: Language not supported
- app/bundles/DynamicContentBundle/Form/Type/DynamicContentType.php: Language not supported
- app/bundles/DynamicContentBundle/Model/DynamicContentModel.php: Language not supported
- app/bundles/DynamicContentBundle/Resources/views/DynamicContent/form.html.twig: Language not supported
- app/bundles/DynamicContentBundle/Tests/Form/Type/DynamicContentTypeTest.php: Language not supported
- app/bundles/DynamicContentBundle/Tests/Validator/Constraints/SlotNameTypeValidatorTest.php: Language not supported
- app/bundles/DynamicContentBundle/Translations/en_US/messages.ini: Language not supported
- app/bundles/DynamicContentBundle/Translations/en_US/validators.ini: Language not supported
- app/bundles/DynamicContentBundle/Validator/Constraints/SlotNameType.php: Language not supported
- app/bundles/DynamicContentBundle/Validator/Constraints/SlotNameTypeValidator.php: Language not supported
- app/bundles/DynamicContentBundle/Validator/Constraints/TypeChoice.php: Language not supported
- app/bundles/DynamicContentBundle/Validator/Constraints/TypeChoiceValidator.php: Language not supported
- app/bundles/EmailBundle/Config/config.php: Language not supported
- app/bundles/EmailBundle/Entity/Email.php: Language not supported
- app/bundles/EmailBundle/Tests/Controller/EmailControllerFunctionalTest.php: Language not supported
- app/bundles/EmailBundle/Translations/en_US/validators.ini: Language not supported
Comments suppressed due to low confidence (2)
app/bundles/DynamicContentBundle/Assets/js/dynamicContent.js:147
- Ensure that the global variable ckEditors is defined before checking its size to prevent potential runtime errors if the load order of scripts changes.
if (ckEditors.size > 0) {
app/bundles/DynamicContentBundle/Assets/js/dynamicContent.js:148
- [nitpick] Consider using an arrow function instead of a traditional function expression for consistency with ES6 syntax throughout the codebase.
ckEditors.forEach(function(value, key, map){
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 7.x #14759 +/- ##
============================================
+ Coverage 64.77% 64.94% +0.16%
- Complexity 34831 34847 +16
============================================
Files 2289 2293 +4
Lines 103954 103932 -22
============================================
+ Hits 67340 67497 +157
+ Misses 36614 36435 -179
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nileshlohar! Please see my suggestions.
app/bundles/EmailBundle/Validator/TextOnlyDynamicContentValidator.php
Outdated
Show resolved
Hide resolved
app/bundles/EmailBundle/Validator/TextOnlyDynamicContentValidator.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nileshlohar for addressing my suggestions!
I found some potential issues with this implementation:
@escopecz @nileshlohar @dadarya0 @fedys Could you clarify how the feature works? |
Hi @andersonjeccel,
This issue was fixed in - #14901
Which options you mean? Can you share more info or perhaps a screenshot ?
The Type field was introduced to differentiate Text Only DC, which can be used particularly in cases where it is embedded—for example, in an email subject. |
@nileshlohar Re. 1, got it Re. 2: Questions that come in my mind:
Depending on the answers, we might need to update display conditions to avoid showing the generator for something users cannot use on the website (or maybe offer an additional option, the token, so they can insert in emails etc) I'm just trying to understand how these types work and differ before making any UX changes |
@andersonjeccel We have more PRs implementing DWC into emails that will be pushed soon if not already. There will be special token to add to emails. We should expand this UI with that new token in the PR that is adding it. Both the text and HTML type can be used in both emails and pages. The text type is there for special cases like email subject that should not have any HTML markup as Nilesh pointed out. |
Hi @nileshlohar I am not seeing any documentation here for end-users or developers. We'll need to have the relevant changes made please. End user would be highest priority, we haven't ported over the dev docs quite yet (cc @mautic/education-team-leaders FYI). Here's the end-user repo: https://github.com/mautic/user-documentation (I think this page is the most appropriate: https://docs.mautic.org/en/7.0/components/dynamic_web_content.html perhaps?) Here's the developer docs repo: https://github.com/mautic/developer-documentation-new - I think we haven't brought over the DWC content yet, looks like this is the old docs: https://developer.mautic.org/#dynamic-content. |
Description
Adds new type field in DWC with options as text and html, based on this selection, the content can either be Text or HTML.
It also adds below validations:
📋 Steps to test this PR: