PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.32
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.32
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/models/FrmFormAction.php +45 -13 6.306.32 View file →
@@ -140,9 +140,17 @@
140 140 if ( ! defined( 'ABSPATH' ) ) {
141 141 die( 'You are not allowed to call this page directly.' );
142 142 }
143 143
144 - $this->id_base = strtolower( $id_base );
144 + $this->id_base = strtolower( $id_base );
145 +
146 + /**
147 + * @since 6.31
148 + *
149 + * @param string $name
150 + */
151 + $name = apply_filters( 'frm_' . $id_base . '_action_name', $name );
152 +
145 153 $this->name = $name;
146 154 $this->option_name = 'frm_' . $this->id_base . '_action';
147 155
148 156 $default_options = array(
@@ -157,8 +165,11 @@
157 165 'tooltip' => $name,
158 166 'group' => $id_base,
159 167 'color' => '',
160 168 'keywords' => '',
169 + 'description' => '',
170 + 'is_new' => false,
171 + 'is_beta' => false,
161 172 );
162 173
163 174 $action_options = apply_filters( 'frm_' . $id_base . '_action_options', $action_options );
164 175 $group = $this->get_group( $action_options );
@@ -164,11 +175,12 @@
164 175 $group = $this->get_group( $action_options );
165 176 $action_options['group'] = $group['id'];
166 177
167 178 if ( ! isset( $action_options['color'] ) ) {
168 - $colors = array( 'green', 'orange', 'purple' );
169 - shuffle( $colors );
170 - $action_options['color'] = 'var(--' . reset( $colors ) . ')';
179 + // Deterministic fallback so all instances of the same action type render with the same color across requests.
180 + $colors = array( 'green', 'orange', 'purple' );
181 + $index = abs( crc32( $id_base ) ) % count( $colors );
182 + $action_options['color'] = 'var(--' . $colors[ $index ] . ')';
171 183 }
172 184
173 185 $upgrade_class = isset( $action_options['classes'] ) && $action_options['classes'] === 'frm_show_upgrade';
174 186
@@ -967,11 +979,12 @@
967 979 * @return array
968 980 */
969 981 public static function default_action_opts( $class = '' ) {
970 982 return array(
971 - 'classes' => 'frmfont ' . $class,
972 - 'active' => false,
973 - 'limit' => 0,
983 + 'classes' => 'frmfont ' . $class,
984 + 'active' => false,
985 + 'limit' => 0,
986 + 'description' => '',
974 987 );
975 988 }
976 989
977 990 /**
@@ -989,18 +1002,37 @@
989 1002 return apply_filters( 'frm_action_triggers', $triggers );
990 1003 }
991 1004
992 1005 /**
1006 + * @param string $action_key The unique key for this action instance.
1007 + *
993 1008 * @return void
994 1009 */
995 - public function render_conditional_logic_call_to_action() {
1010 + public function render_conditional_logic_call_to_action( $action_key = '' ) {
1011 + $params = array(
1012 + 'class' => 'frm-h-stack-xs frm-bt-200 frm-py-md frm_show_upgrade',
1013 + 'data-upgrade' => $this->get_upgrade_text(),
1014 + 'data-medium' => 'conditional-' . $this->id_base,
1015 + );
996 1016 // phpcs:disable Generic.WhiteSpace.ScopeIndent
997 1017 ?>
998 - <h3>
999 - <a href="javascript:void(0)" class="frm_show_upgrade frm_noallow" data-upgrade="<?php echo esc_attr( $this->get_upgrade_text() ); ?>" data-medium="conditional-<?php echo esc_attr( $this->id_base ); ?>"><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
1000 - <?php esc_html_e( 'Use Conditional Logic', 'formidable' ); ?>
1001 - </a>
1002 - </h3>
1018 + <div <?php FrmAppHelper::array_to_html_params( $params, true ); ?>>
1019 + <?php
1020 + FrmHtmlHelper::toggle(
1021 + 'frm_logic_cta_' . $action_key,
1022 + 'frm_logic_cta_' . $action_key,
1023 + array(
1024 + 'div_class' => 'with_frm_style frm_toggle',
1025 + 'checked' => false,
1026 + 'echo' => true,
1027 + 'disabled' => true,
1028 + )
1029 + );
1030 + ?>
1031 + <label for="frm_logic_cta_<?php echo esc_attr( $action_key ); ?>" class="frm_noallow">
1032 + <?php esc_html_e( 'Use Conditional Logic', 'formidable' ); ?>
1033 + </label>
1034 + </div>
1003 1035 <?php
1004 1036 // phpcs:enable Generic.WhiteSpace.ScopeIndent
1005 1037 }
1006 1038