- Timestamp:
- 10/14/2026 04:54:36 PM (2 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
formidable/trunk/classes/helpers/FrmStylesPreviewHelper.php
r3574848 r3746820 209 209 add_filter( 'frm_is_admin', '__return_false' ); 210 210 211 $target_form_preview_html = FrmFormsController::show_form( $this->form_id, '', 'auto', 'auto' ); 212 213 $this->form_includes_captcha = wp_script_is( 'captcha-api', 'enqueued' ); 214 215 if ( $this->form_includes_captcha ) { 216 // If a form includes a CAPTCHA field, don't try to load the CAPTCHA scripts for the visual styler preview. 217 wp_dequeue_script( 'captcha-api' ); 218 } 219 220 // Return the is_admin status. 221 // Otherwise success messages won't use the proper mark up and will appear without the green background and padding. 222 remove_filter( 'frm_is_admin', '__return_false' ); 223 224 return $target_form_preview_html; 211 // The styler edit page also renders its own settings form, so this preview's <form> landmark 212 // needs a distinct name to avoid tripping the aria_landmark_name_unique a11y rule. 213 add_filter( 'frm_form_attributes', array( $this, 'add_preview_landmark_label' ) ); 214 215 try { 216 $target_form_preview_html = FrmFormsController::show_form( $this->form_id, '', 'auto', 'auto' ); 217 218 $this->form_includes_captcha = wp_script_is( 'captcha-api', 'enqueued' ); 219 220 if ( $this->form_includes_captcha ) { 221 // If a form includes a CAPTCHA field, don't try to load the CAPTCHA scripts for the visual styler preview. 222 wp_dequeue_script( 'captcha-api' ); 223 } 224 225 return $target_form_preview_html; 226 } finally { 227 remove_filter( 'frm_form_attributes', array( $this, 'add_preview_landmark_label' ) ); 228 229 // Return the is_admin status. 230 // Otherwise success messages won't use the proper mark up and will appear without the green background and padding. 231 remove_filter( 'frm_is_admin', '__return_false' ); 232 } 233 } 234 235 /** 236 * @since 7.0 237 * 238 * @param string $attributes 239 * 240 * @return string 241 */ 242 public function add_preview_landmark_label( $attributes ) { 243 return $attributes . ' aria-label="' . esc_attr__( 'Form preview', 'formidable' ) . '"'; 225 244 } 226 245
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)