improve primary color from quick settings style editor#2054
Conversation
WalkthroughThe pull request introduces several changes across multiple files, including the addition of a new method Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Thanks @Liviu-p, it looks great to me. 🚀
However, when the Pro add-on isn't activated, the color pickers' colors are missing as shown below:
There is a strong white color that, if disabled, will fix it:
Are you aware of this, or is it a new issue?
…ms into issue-pro/5377
Nice catch @shervElmi, I wasn't aware of it. Thank you for pointing it out!. Could you please take another look over it? |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (3)
classes/views/styles/_style-options.php (2)
23-23: LGTM! Consider extracting common class names.The use of
FrmStylesHelper::style_editor_get_wrapper_classname()here is consistent with the previous change, which is good for maintainability.For improved readability and maintainability, consider extracting the common class names into a variable. Here's a suggested refactor:
-<div class="frm-quick-settings frm_grid_container <?php echo esc_attr( FrmStylesHelper::style_editor_get_wrapper_classname( 'quick-settings' ) ); ?>"> +<?php +$quick_settings_classes = 'frm-quick-settings frm_grid_container ' . FrmStylesHelper::style_editor_get_wrapper_classname( 'quick-settings' ); +?> +<div class="<?php echo esc_attr( $quick_settings_classes ); ?>">This change would make the code more readable and easier to maintain, especially if more classes need to be added in the future.
19-23: Overall improvement in style editor flexibilityThe changes in this file represent a positive step towards a more dynamic and maintainable style editor. The introduction of the
style_editor_get_wrapper_classname()method allows for context-aware class assignments, which should improve the ability to control the display and behavior of different sections of the style editor.To further improve the code:
- Ensure that the
style_editor_get_wrapper_classname()method is well-documented and tested.- Consider adding comments explaining the purpose of these dynamic class assignments for future maintainers.
- If these changes are part of a larger refactoring effort, ensure that all related files are updated consistently.
classes/helpers/FrmStylesHelper.php (1)
882-898: New methodstyle_editor_get_wrapper_classnamelooks good, with a minor suggestion.The new method
style_editor_get_wrapper_classnameis well-implemented and provides a clear way to generate class names for style editor sections. However, there's a small optimization that could be made:
- The
$is_quick_settingsvariable is only used once, so it could be inlined for better readability.Consider applying this change for improved readability:
public static function style_editor_get_wrapper_classname( $section_type ) { - $is_quick_settings = ( 'quick-settings' === $section_type ); $classname = 'frm-style-editor-form'; - $classname .= ( ! self::is_advanced_settings() xor $is_quick_settings ) ? ' frm_hidden' : ''; + $classname .= ( ! self::is_advanced_settings() xor 'quick-settings' === $section_type ) ? ' frm_hidden' : ''; $classname .= FrmAppHelper::pro_is_installed() ? ' frm-pro' : ''; return $classname; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- classes/helpers/FrmStylesHelper.php (1 hunks)
- classes/views/styles/_style-options.php (1 hunks)
- css/admin/style-components.css (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
classes/views/styles/_style-options.php (1)
19-19: LGTM! Verify the behavior of the new method.The introduction of
FrmStylesHelper::style_editor_get_wrapper_classname()appears to improve the flexibility of class assignments in the style editor. This change likely enhances the dynamic styling capabilities of the interface.To ensure the new method behaves as expected, please run the following verification script:
✅ Verification successful
LGTM! Verify the behavior of the new method.
The
FrmStylesHelper::style_editor_get_wrapper_classname()method is correctly implemented and utilized in the codebase. While automated pattern matching did not capture the method definition, manual verification confirms its presence and usage in relevant sections. Please ensure that the method behaves as expected within the style editor interface.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the implementation and usage of style_editor_get_wrapper_classname method # Test 1: Check the method implementation echo "Checking method implementation:" ast-grep --lang php --pattern 'function style_editor_get_wrapper_classname($_) { $$$ }' # Test 2: Check for other usages of the method echo "Checking other usages of the method:" rg --type php 'style_editor_get_wrapper_classname'Length of output: 774
Script:
#!/bin/bash # Description: Re-verify the implementation and usage of style_editor_get_wrapper_classname method with updated patterns # Test 1: Check the method implementation with visibility modifiers echo "Rechecking method implementation with visibility modifiers:" ast-grep --lang php --pattern 'public static function style_editor_get_wrapper_classname($_) { $$$ }' # Test 2: Confirm all usages of the method echo "Confirming all usages of the method:" rg --type php 'style_editor_get_wrapper_classname'Length of output: 844
Script:
#!/bin/bash # Description: Re-verify the implementation of style_editor_get_wrapper_classname method with flexible whitespace handling # Test 1: Check the method implementation with flexible whitespace echo "Rechecking method implementation with flexible whitespace:" ast-grep --lang php --pattern 'public static function style_editor_get_wrapper_classname\s*\(\s*\$\w+\s*\)\s*\{ $$$ \}' # Test 2: Confirm all usages of the method echo "Confirming all usages of the method:" rg --type php 'style_editor_get_wrapper_classname'Length of output: 860
classes/helpers/FrmStylesHelper.php (1)
Line range hint
899-920: Updatedget_submit_image_bg_urlmethod handles both URL and attachment ID.The changes to the
get_submit_image_bg_urlmethod are well-implemented. It now supports both full URL strings (for backwards compatibility) and numeric attachment IDs (new feature in version 6.14). The method effectively handles both cases, ensuring compatibility with older saved settings while supporting the new functionality.






Fixes https://github.com/Strategy11/formidable-pro/issues/5377