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/models/FrmFieldFormHtml.php +12 -2 6.31 → trunk View file →
@@ -291,9 +291,17 @@
291 291 private function replace_error_shortcode() {
292 292 $this->maybe_add_error_id();
293 293 $error = $this->pass_args['errors'][ 'field' . $this->field_id ] ?? false;
294 294
295 - if ( $error && ! str_contains( $this->html, 'role="alert"' ) && FrmAppHelper::should_include_alert_role_on_field_errors() ) {
295 + if ( ! $error ) {
296 + FrmShortcodeHelper::remove_inline_conditions( false, 'error', $error, $this->html );
297 + return;
298 + }
299 +
300 + $include_alert_role_on_field_errors = FrmAppHelper::should_include_alert_role_on_field_errors();
301 + $has_alert_role = str_contains( $this->html, 'role="alert"' );
302 +
303 + if ( ! $has_alert_role && $include_alert_role_on_field_errors ) {
296 304 $error_body = self::get_error_body( $this->html );
297 305
298 306 if ( is_string( $error_body ) && ! str_contains( $error_body, 'role=' ) ) {
299 307 $new_error_body = preg_replace( '/class="frm_error/', 'role="alert" class="frm_error', $error_body, 1 );
@@ -298,11 +306,13 @@
298 306 if ( is_string( $error_body ) && ! str_contains( $error_body, 'role=' ) ) {
299 307 $new_error_body = preg_replace( '/class="frm_error/', 'role="alert" class="frm_error', $error_body, 1 );
300 308 $this->html = str_replace( '[if error]' . $error_body . '[/if error]', '[if error]' . $new_error_body . '[/if error]', $this->html );
301 309 }
310 + } elseif ( ! $include_alert_role_on_field_errors && $has_alert_role ) {
311 + $this->html = str_replace( 'role="alert"', '', $this->html );
302 312 }
303 313
304 - FrmShortcodeHelper::remove_inline_conditions( ! empty( $error ), 'error', $error, $this->html );
314 + FrmShortcodeHelper::remove_inline_conditions( true, 'error', $error, $this->html );
305 315 }
306 316
307 317 /**
308 318 * Pull the HTML between [if error] and [/if error] shortcodes.