post_type || 'post' !== $screen->base ) {
return;
}
$code = static fn( string $tag ): string => '' . esc_html( $tag ) . '';
$list = static fn( array $items ): string => '
' . esc_html__( 'Build the form in the Form tab: click or drag fields from the left into the form, drag cards to reorder them, and select a card to change its settings on the right. Use the up and down buttons on each card to move it with the keyboard. Switch to Tags to see or edit the form as tags. Then set where messages go in the Mail tab, publish, and embed the form with its shortcode or the Flexsolutions Form Builder block. The Configuration check box lists anything that needs attention.', 'flexsolutions-form-builder' ) . '
', ) ); $screen->add_help_tab( array( 'id' => 'tflexforms-tags', 'title' => __( 'Form tags', 'flexsolutions-form-builder' ), 'content' => '' . esc_html__( 'Syntax: [type name options "values"]. Add * after the type to make a field required. In the Tags view, the buttons above the tags build them for you.', 'flexsolutions-form-builder' ) . '
' . $list( array( $code( '[text* your-name maxlength:100 counter]' ) . ' ' . esc_html__( 'text, email, url, tel, number, date, textarea', 'flexsolutions-form-builder' ), $code( '[select* dept first_as_label "Choose…" "Sales|sales@example.com" "Support"]' ) . ' ' . esc_html__( 'pipes hide the address after |', 'flexsolutions-form-builder' ), $code( '[checkbox topics exclusive free_text "News" "Other"]' ) . ' ' . esc_html__( 'checkbox and radio', 'flexsolutions-form-builder' ), $code( '[acceptance* terms label_first "I agree"]' ), $code( '[range rating min:1 max:10]' ) . ' ' . $code( '[quiz q "What is 3 + 4?|7|seven"]' ), $code( '[hidden campaign default:get]' ) . ' ' . esc_html__( 'defaults: get, post_title, post_url, post_id, user_email, user_login, user_display_name', 'flexsolutions-form-builder' ), $code( '[file* cv limit:2mb filetypes:pdf|doc|docx]' ) . ' ' . esc_html__( 'file upload (default 1 MB; scripts are always refused)', 'flexsolutions-form-builder' ), $code( '[if contact is "Phone"] … [/if]' ) . ' ' . esc_html__( 'show part of the form only when a condition is met (is, not, filled, empty)', 'flexsolutions-form-builder' ), $code( '[response]' ) . ' ' . esc_html__( 'where the message box appears', 'flexsolutions-form-builder' ) . '; ' . $code( '[submit "Send"]' ), esc_html__( 'Other options: placeholder, readonly, size:N, cols:N, rows:N, tabindex:N, id:x, class:a|b, autocomplete:x, min:, max:, step:, minlength:, maxlength:', 'flexsolutions-form-builder' ), ) ), ) ); $screen->add_help_tab( array( 'id' => 'tflexforms-mail', 'title' => __( 'Mail placeholders', 'flexsolutions-form-builder' ), 'content' => '' . esc_html__( 'Use [field-name] for a submitted value. For choice fields with pipes, [field-name] gives the hidden value and [_raw_field-name] the label the visitor saw. In To, CC and BCC, only piped choice fields may be used, so visitors can never choose where mail goes.', 'flexsolutions-form-builder' ) . '
'
. implode( ' ', array_map( static fn( string $t ): string => '[' . esc_html( $t ) . ']', Mailer::SPECIAL_TAGS ) ) . '
' . esc_html__( 'Every form has a hidden honeypot, a minimum fill-in time and a per-visitor rate limit. You can add CAPTCHA (Turnstile, reCAPTCHA v3 or hCaptcha), Akismet and the WordPress disallowed-words list in the Settings tab and in Flexsolutions Form Builder → Settings.', 'flexsolutions-form-builder' ) . '
', ) ); $screen->add_help_tab( array( 'id' => 'tflexforms-style', 'title' => __( 'Style', 'flexsolutions-form-builder' ), 'content' => '' . esc_html__( 'The Style tab sets the look of this form only: a preset, an accent colour, where labels go and how the button looks. Theme follows your theme\'s colours, font and button (change them in Appearance → Editor → Styles); Unstyled leaves the theme\'s own fields and buttons as they are. To change more, use your site\'s Additional CSS and target this form by its class, .tflexforms-form- followed by the form ID.', 'flexsolutions-form-builder' ) . '
', ) ); $screen->set_help_sidebar( '' . esc_html__( 'Flexsolutions Form Builder', 'flexsolutions-form-builder' ) . '
' . esc_html__( 'Full reference: see readme.txt in the plugin folder.', 'flexsolutions-form-builder' ) . '
' ); } /** * Loads editor CSS/JS on our screens only. * * @param string $hook_suffix Current admin page. */ public static function enqueue_assets( string $hook_suffix ): void { $screen = get_current_screen(); if ( null === $screen || Form_Post_Type::POST_TYPE !== $screen->post_type ) { return; } wp_enqueue_style( 'tflexforms-admin', plugins_url( 'assets/css/admin.css', PLUGIN_FILE ), array(), VERSION ); if ( in_array( $hook_suffix, array( 'post.php', 'post-new.php' ), true ) ) { wp_enqueue_script( 'tflexforms-admin', plugins_url( 'assets/js/admin.js', PLUGIN_FILE ), array(), VERSION, array( 'in_footer' => true, 'strategy' => 'defer', ) ); wp_enqueue_script( 'tflexforms-preview', plugins_url( 'assets/js/preview.js', PLUGIN_FILE ), array( 'tflexforms-admin' ), VERSION, array( 'in_footer' => true, 'strategy' => 'defer', ) ); // Field types, settings and translated labels for the builder (JSON, escaped for