Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion classes/helpers/FrmStylesHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ private static function css_var_prepare_value( $settings, $key ) {
case 'font':
return safecss_filter_attr( $value );

case 'border_width_error':
case 'field_border_width':
if ( ! empty( $settings['field_shape_type'] ) && 'underline' === $settings['field_shape_type'] ) {
return safecss_filter_attr( '0px 0px ' . $value . ' 0px' );
Expand Down Expand Up @@ -570,7 +571,7 @@ public static function get_settings_for_output( $style ) {
* @return array
*/
public static function update_base_font_size( $settings, $defaults ) {
if ( empty( $settings['base_font_size'] ) || empty( $settings['use_base_font_size'] ) ) {
if ( empty( $settings['base_font_size'] ) || empty( $settings['use_base_font_size'] ) || 'false' === $settings['use_base_font_size'] ) {
return $settings;
}
$base_font_size = (int) $settings['base_font_size'];
Expand Down
10 changes: 5 additions & 5 deletions classes/models/FrmStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ public function get_defaults() {
'direction' => is_rtl() ? 'rtl' : 'ltr',
'fieldset' => '0px',
'fieldset_color' => '000000',
'fieldset_padding' => '0 0 15px 0',
'fieldset_padding' => '0px 0px 15px 0px',
'fieldset_bg_color' => '',

'title_size' => '40px',
Expand All @@ -631,7 +631,7 @@ public function get_defaults() {
'form_desc_color' => '98A2B3',
'form_desc_margin_top' => '10px',
'form_desc_margin_bottom' => '25px',
'form_desc_padding' => '0',
'form_desc_padding' => '0px',

'font' => '',
'font_size' => '15px',
Expand All @@ -642,14 +642,14 @@ public function get_defaults() {
'width' => '150px',
'required_color' => 'F04438',
'required_weight' => 'bold',
'label_padding' => '0 0 5px 0',
'label_padding' => '0px 0px 5px 0px',

'description_font_size' => '12px',
'description_color' => '667085',
'description_weight' => 'normal',
'description_style' => 'normal',
'description_align' => 'left',
'description_margin' => '0',
'description_margin' => '0px',

'field_font_size' => '14px',
'field_height' => '36px',
Expand Down Expand Up @@ -689,7 +689,7 @@ public function get_defaults() {
'section_font_size' => '18px',
'section_color' => '344054',
'section_weight' => 'bold',
'section_pad' => '32px 0 3px 0',
'section_pad' => '32px 0px 3px 0px',
'section_mar_top' => '30px',
'section_mar_bottom' => '30px',
'section_bg_color' => '',
Expand Down
4 changes: 2 additions & 2 deletions classes/views/styles/_field-colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
$frm_style->get_field_name( 'remove_box_shadow' ),
array(
'div_class' => 'with_frm_style frm_toggle',
'checked' => ! $style->post_content['remove_box_shadow'],
'checked' => ! empty( $style->post_content['remove_box_shadow'] ),
'echo' => true,
)
);
Expand Down Expand Up @@ -167,7 +167,7 @@
$frm_style->get_field_name( 'remove_box_shadow_active' ),
array(
'div_class' => 'with_frm_style frm_toggle',
'checked' => ! $style->post_content['remove_box_shadow_active'],
'checked' => ! empty( $style->post_content['remove_box_shadow_active'] ),
'echo' => true,
'aria-label-attr' => __( 'Toggle box shadow', 'formidable' ),
)
Expand Down
9 changes: 7 additions & 2 deletions classes/views/styles/_quick-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,12 @@
<hr class="frm12"/>
<div class="frm5 frm_form_field"><label class="frm-style-item-heading"><?php esc_html_e( 'Base Font Size', 'formidable' ); ?></label></div>
<div class="frm7 frm_form_field">
<?php if ( ! FrmStylesHelper::is_advanced_settings() ) { ?>
<input type="hidden" name="<?php echo esc_attr( $frm_style->get_field_name( 'use_base_font_size' ) ); ?>" value="true" />
<?php
if ( ! FrmStylesHelper::is_advanced_settings() ) {
// This is displayed only in "Quick Settings" and has a default value of "false." It is updated via JavaScript when the Base Font Size slider is adjusted.
// When set to false, the sizes in "Advanced Settings" will not be modified.
?>
<input type="hidden" name="<?php echo esc_attr( $frm_style->get_field_name( 'use_base_font_size' ) ); ?>" value="false" />
Comment thread
Crabcyborg marked this conversation as resolved.
<?php } ?>
<?php
new FrmSliderStyleComponent(
Expand All @@ -142,6 +146,7 @@
'id' => 'base_font_size',
'max_value' => 100,
'not_show_in' => 'advanced-settings',
'classname' => 'frm-base-font-size',
)
);
?>
Expand Down
23 changes: 14 additions & 9 deletions classes/views/styles/components/FrmSliderStyleComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function __construct( $field_name, $field_value, $data ) {
$this->data['unit_measurement'] = $this->detect_unit_measurement();
$this->data['has-multiple-values'] = count( $this->get_values() ) > 1;
$this->data['units'] = $this->get_units_list( $data );
$this->data['value_label'] = empty( $this->detect_unit_measurement() ) ? $field_value : (int) $field_value;

$this->init_defaults();
$this->init_icon();
Expand All @@ -53,8 +54,9 @@ public function __construct( $field_name, $field_value, $data ) {
*/
private function get_units_list( $data ) {
if ( empty( $data['units'] ) ) {
return array( 'px', 'em', '%' );
return array( '', 'px', 'em', '%' );
}
array_unshift( $data['units'], '' );
return $data['units'];
}

Expand Down Expand Up @@ -89,33 +91,33 @@ private function init_multiple_values() {
$right = $values[1];

$this->data['vertical'] = array(
'value' => $top,
'unit' => $this->detect_unit_measurement( $top ),
'value' => empty( $this->detect_unit_measurement( $top ) ) ? $top : (int) $top,
);

$this->data['horizontal'] = array(
'value' => $right,
'unit' => $this->detect_unit_measurement( $right ),
'value' => empty( $this->detect_unit_measurement( $right ) ) ? $right : (int) $right,
);

$this->data['top'] = array(
'value' => $top,
'unit' => $this->detect_unit_measurement( $top ),
'value' => empty( $this->detect_unit_measurement( $top ) ) ? $top : (int) $top,
);

$this->data['bottom'] = array(
'value' => $bottom,
'unit' => $this->detect_unit_measurement( $bottom ),
'value' => empty( $this->detect_unit_measurement( $bottom ) ) ? $bottom : (int) $bottom,
);

$this->data['left'] = array(
'value' => $left,
'unit' => $this->detect_unit_measurement( $left ),
'value' => empty( $this->detect_unit_measurement( $left ) ) ? $left : (int) $left,
);

$this->data['right'] = array(
'value' => $right,
'unit' => $this->detect_unit_measurement( $right ),
'value' => empty( $this->detect_unit_measurement( $right ) ) ? $right : (int) $right,
);
}

Expand All @@ -133,7 +135,7 @@ private function get_values() {

/**
* Detect the unit measurement from the value.
* Possible values are: px, %, em.
* Possible values are: "px", "%", "em" or empty ""
*
* @since 6.14
*
Expand All @@ -150,8 +152,11 @@ private function detect_unit_measurement( $value = null ) {
if ( preg_match( '/em$/', $value ) ) {
return 'em';
}
if ( preg_match( '/px$/', $value ) ) {
return 'px';
}

return 'px';
return '';
}

/**
Expand Down
3 changes: 3 additions & 0 deletions classes/views/styles/components/FrmStyleComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ protected function init_field_data( $data, $field_name, $field_value ) {
*/
protected function get_default_wrapper_class_names() {
$class = 'frm-style-component';
if ( ! empty( $this->data['classname'] ) ) {
$class .= ' ' . $this->data['classname'];
}
if ( ! empty( $this->data['will_change'] ) ) {
return $class . ' frm-style-dependent-updater-component';
}
Expand Down
18 changes: 9 additions & 9 deletions classes/views/styles/components/templates/slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</span>
</div>
<div class="frm-slider-value">
<input aria-label="<?php echo esc_attr__( 'Vertical value', 'formidable' ); ?>" type="text" value="<?php echo (int) $component['vertical']['value']; ?>" />
<input aria-label="<?php echo esc_attr__( 'Vertical value', 'formidable' ); ?>" type="text" value="<?php echo esc_attr( $component['vertical']['value'] ); ?>" />
<select aria-label="<?php echo esc_attr__( 'Value unit', 'formidable' ); ?>">
<?php foreach ( $component['units'] as $unit ) : ?>
<option <?php selected( $component['vertical']['unit'], $unit ); ?> value="<?php echo esc_attr( $unit ); ?>"><?php echo esc_html( $unit ); ?></option>
Expand All @@ -38,7 +38,7 @@
</span>
</div>
<div class="frm-slider-value">
<input aria-label="<?php echo esc_attr__( 'Top value', 'formidable' ); ?>" type="text" value="<?php echo (int) $component['top']['value']; ?>" />
<input aria-label="<?php echo esc_attr__( 'Top value', 'formidable' ); ?>" type="text" value="<?php echo esc_attr( $component['top']['value'] ); ?>" />
<select aria-label="<?php echo esc_attr__( 'Value unit', 'formidable' ); ?>">
<?php foreach ( $component['units'] as $unit ) : ?>
<option <?php selected( $component['top']['unit'], $unit ); ?> value="<?php echo esc_attr( $unit ); ?>"><?php echo esc_html( $unit ); ?></option>
Expand All @@ -60,7 +60,7 @@
</span>
</div>
<div class="frm-slider-value">
<input aria-label="<?php echo esc_attr__( 'Bottom value', 'formidable' ); ?>" type="text" value="<?php echo (int) $component['bottom']['value']; ?>" />
<input aria-label="<?php echo esc_attr__( 'Bottom value', 'formidable' ); ?>" type="text" value="<?php echo esc_attr( $component['bottom']['value'] ); ?>" />
<select aria-label="<?php echo esc_attr__( 'Value unit', 'formidable' ); ?>">
<?php foreach ( $component['units'] as $unit ) : ?>
<option <?php selected( $component['bottom']['unit'], $unit ); ?> value="<?php echo esc_attr( $unit ); ?>"><?php echo esc_html( $unit ); ?></option>
Expand All @@ -82,7 +82,7 @@
</span>
</div>
<div class="frm-slider-value">
<input aria-label="<?php echo esc_attr__( 'Horizontal value', 'formidable' ); ?>" type="text" value="<?php echo (int) $component['horizontal']['value']; ?>" />
<input aria-label="<?php echo esc_attr__( 'Horizontal value', 'formidable' ); ?>" type="text" value="<?php echo esc_attr( $component['horizontal']['value'] ); ?>" />
<select aria-label="<?php echo esc_attr__( 'Value unit', 'formidable' ); ?>">
<?php foreach ( $component['units'] as $unit ) : ?>
<option <?php selected( $component['horizontal']['unit'], $unit ); ?> value="<?php echo esc_attr( $unit ); ?>"><?php echo esc_html( $unit ); ?></option>
Expand All @@ -104,7 +104,7 @@
</span>
</div>
<div class="frm-slider-value">
<input aria-label="<?php echo esc_attr__( 'Left value', 'formidable' ); ?>" type="text" value="<?php echo (int) $component['left']['value']; ?>" />
<input aria-label="<?php echo esc_attr__( 'Left value', 'formidable' ); ?>" type="text" value="<?php echo esc_attr( $component['left']['value'] ); ?>" />
<select aria-label="<?php echo esc_attr__( 'Value unit', 'formidable' ); ?>">
<?php foreach ( $component['units'] as $unit ) : ?>
<option <?php selected( $component['left']['unit'], $unit ); ?> value="<?php echo esc_attr( $unit ); ?>"><?php echo esc_html( $unit ); ?></option>
Expand All @@ -126,7 +126,7 @@
</span>
</div>
<div class="frm-slider-value">
<input aria-label="<?php echo esc_attr__( 'Right value', 'formidable' ); ?>" type="text" value="<?php echo (int) $component['right']['value']; ?>" />
<input aria-label="<?php echo esc_attr__( 'Right value', 'formidable' ); ?>" type="text" value="<?php echo esc_attr( $component['right']['value'] ); ?>" />
<select aria-label="<?php echo esc_attr__( 'Value unit', 'formidable' ); ?>">
<?php foreach ( $component['units'] as $unit ) : ?>
<option <?php selected( $component['right']['unit'], $unit ); ?> value="<?php echo esc_attr( $unit ); ?>"><?php echo esc_html( $unit ); ?></option>
Expand Down Expand Up @@ -155,7 +155,7 @@
</span>
</div>
<div class="frm-slider-value">
<input aria-label="<?php echo esc_attr__( 'Field value', 'formidable' ); ?>" type="text" value="<?php echo (int) $field_value; ?>" />
<input aria-label="<?php echo esc_attr__( 'Field value', 'formidable' ); ?>" type="text" value="<?php echo esc_attr( $component['value_label'] ); ?>" />
<input type="hidden" <?php echo esc_attr( $field_name ); ?> value="<?php echo esc_attr( $field_value ); ?>" id="<?php echo esc_attr( $component['id'] ); ?>" />
<select aria-label="<?php echo esc_attr__( 'Value unit', 'formidable' ); ?>">
<?php foreach ( $component['units'] as $unit ) : ?>
Expand All @@ -180,7 +180,7 @@
</span>
</div>
<div class="frm-slider-value">
<input aria-label="<?php echo esc_attr__( 'Field value', 'formidable' ); ?>" type="text" value="<?php echo (int) $field_value; ?>" />
<input aria-label="<?php echo esc_attr__( 'Field value', 'formidable' ); ?>" type="text" value="<?php echo esc_attr( $component['value_label'] ); ?>" />
<select aria-label="<?php echo esc_attr__( 'Value unit', 'formidable' ); ?>">
<?php foreach ( $component['units'] as $unit ) : ?>
<option <?php selected( $component['unit_measurement'], $unit ); ?> value="<?php echo esc_attr( $unit ); ?>"><?php echo esc_html( $unit ); ?></option>
Expand All @@ -207,7 +207,7 @@
</span>
</div>
<div class="frm-slider-value">
<input aria-label="<?php echo esc_attr__( 'Field value', 'formidable' ); ?>" type="text" value="<?php echo (int) $field['value']; ?>" />
<input aria-label="<?php echo esc_attr__( 'Field value', 'formidable' ); ?>" type="text" value="<?php echo empty( $component['unit_measurement'] ) ? esc_attr( $field['value'] ) : (int) $field['value']; ?>" />
<input type="hidden" <?php echo esc_attr( $field['name'] ); ?> value="<?php echo esc_attr( $field['value'] ); ?>" id="<?php echo esc_attr( $field['id'] ); ?>" />
<select aria-label="<?php echo esc_attr__( 'Value unit', 'formidable' ); ?>">
<?php foreach ( $component['units'] as $unit ) : ?>
Expand Down
4 changes: 2 additions & 2 deletions css/_single_theme.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
color:<?php echo esc_html( $text_color_error . $important ); ?>;
background-color:<?php echo esc_html( $bg_color_error . $important ); ?>;
border-color:<?php echo esc_html( $border_color_error . $important ); ?>;
border-width:<?php echo esc_html( $border_width_error . $important ); ?>;
border-width:var(--border-width-error) <?php echo esc_html( $important ); ?>;
border-style:<?php echo esc_html( $border_style_error . $important ); ?>;
}

Expand All @@ -384,7 +384,7 @@

.<?php echo esc_html( $style_class ); ?> .frm_error,
.<?php echo esc_html( $style_class ); ?> .frm_limit_error{
color:<?php echo esc_html( $border_color_error . $important ); ?>;
color:<?php echo esc_html( $text_color_error . $important ); ?>;
}

.<?php echo esc_html( $style_class ); ?> .frm_error_style{
Expand Down
6 changes: 6 additions & 0 deletions css/admin/style-components.css
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@
.frm-slider-component.frm-disabled .frm-slider-value select {
width: 56px;
}
.frm-slider-component.frm-disabled.frm-empty .frm-slider-value input[type="text"] {
width: 56px;
}
.frm-slider-component.frm-disabled.frm-empty .frm-slider-value select {
width: 28px;
}

.frm-tabs-wrapper {
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion js/form-templates.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/formidable_dashboard.js.map

Large diffs are not rendered by default.

Loading