-
Notifications
You must be signed in to change notification settings - Fork 35
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
Fix border styles for underline styles #2027
base: master
Are you sure you want to change the base?
Fix border styles for underline styles #2027
Conversation
WalkthroughThe changes in this pull request focus on enhancing the CSS output for form styling within the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- css/_single_theme.css.php (1 hunks)
🔇 Additional comments (1)
css/_single_theme.css.php (1)
135-148
: LGTM: Correct application of styles for.frm_scale label
The styles are conditionally applied based on the settings, and the values are properly escaped. This ensures that labels within
.frm_scale
elements are styled correctly according to user-defined settings.
css/_single_theme.css.php
Outdated
if ( ! empty( $field_border_width ) && false !== strpos( $field_border_width, ' ' ) ) { | ||
$border_width = explode( ' ', str_replace( 'px', '', $field_border_width ) ); | ||
$border_width = max( $border_width ) . 'px'; | ||
?> | ||
.<?php echo esc_html( $style_class ); ?> .frm_image_options .frm_image_option_container { | ||
border-width:<?php echo esc_html( $border_width . $important ); ?>; | ||
} |
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.
Sanitize $field_border_width
to prevent potential issues
When $field_border_width
contains non-numeric values or unexpected input, using max()
directly on the array may lead to warnings or incorrect CSS output. To ensure robustness, consider validating that the extracted values are numeric before computing the maximum.
Apply this change to sanitize the border width values:
$border_width_values = explode( ' ', str_replace( 'px', '', $field_border_width ) );
$border_width_values = array_filter( $border_width_values, 'is_numeric' );
if ( ! empty( $border_width_values ) ) {
$border_width = max( $border_width_values ) . 'px';
?>
.<?php echo esc_html( $style_class ); ?> .frm_image_options .frm_image_option_container {
border-width:<?php echo esc_html( $border_width . $important ); ?>;
}
<?php
}
$border_width = explode( ' ', str_replace( 'px', '', esc_html( $field_border_width ) ) ); | ||
$border_width = max( $border_width ) . 'px'; | ||
?> | ||
.<?php echo esc_html( $style_class ); ?> .frm_image_options .frm_image_option_container { |
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 @AbdiTolesa.
Is it possible to do this update in Pro instead? Ideally any references to frm_image_option_container
can be done in Pro, since displaying radio buttons/checkboxes as images is a Pro feature.
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.
I just realized we can do that in single-style.css
in Pro and I have done that but I think you haven't seen my question on this solution in the Pro PR: https://github.com/Strategy11/formidable-pro/pull/4771#discussion_r1787431210
Fix https://github.com/Strategy11/formidable-pro/issues/3409
Test steps:
*Remember to update your styles before test.
Before
![image](https://github.com/Strategy11/formidable-pro/assets/41271840/8eb31791-28b2-4e3c-86a2-e1647900ef4f)
After
![image](https://github.com/Strategy11/formidable-pro/assets/41271840/870d6da2-7ce1-45b6-b400-7cbbd12e66ff)