PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/helpers/FrmStylesPreviewHelper.php +41 -0 6.31 → trunk View file →
@@ -56,8 +56,49 @@
56 56 add_filter( 'frm_run_honeypot', '__return_false' );
57 57 $this->hide_captcha_fields();
58 58 $this->disable_javascript_validation();
59 59 $this->add_a_div_class_for_default_label_positions();
60 + $this->add_a_div_class_for_style_driven_alignment();
61 + }
62 +
63 + /**
64 + * Add a marker class to radio and checkbox fields that use the style's option
65 + * alignment setting rather than a field level override.
66 + *
67 + * Only fields with this class change when the radio or checkbox alignment style
68 + * setting is updated in the styler preview. Fields with their own alignment
69 + * override are left untouched.
70 + *
71 + * @since 6.32
72 + *
73 + * @return void
74 + */
75 + private function add_a_div_class_for_style_driven_alignment() {
76 + add_filter(
77 + 'frm_field_div_classes',
78 + /**
79 + * @param string $classes
80 + * @param array|object $field
81 + *
82 + * @return string
83 + */
84 + function ( $classes, $field ) {
85 + if ( ! FrmField::is_radio( $field ) && ! FrmField::is_checkbox( $field ) ) {
86 + return $classes;
87 + }
88 +
89 + // Mirror FrmFieldType::get_container_class(): an override only exists in Pro.
90 + $align = FrmAppHelper::pro_is_installed() ? FrmField::get_option( $field, 'align' ) : '';
91 +
92 + if ( ! $align ) {
93 + $classes .= ' frm-default-option-align';
94 + }
95 +
96 + return $classes;
97 + },
98 + 10,
99 + 2
100 + );
60 101 }
61 102
62 103 /**
63 104 * Add a frm-default-label-position class to any field with a default label position.