__( 'First name', 'ai-eshop-optimizer' ), 'last_name' => __( 'Last name', 'ai-eshop-optimizer' ), 'phone' => __( 'Phone', 'ai-eshop-optimizer' ), 'city' => __( 'City', 'ai-eshop-optimizer' ), 'country' => __( 'Country', 'ai-eshop-optimizer' ), 'company' => __( 'Company', 'ai-eshop-optimizer' ), 'message' => __( 'Message', 'ai-eshop-optimizer' ), ); $aieo_cf_check = static function ( $key, $label, $aria = '', $help = '' ) use ( $aieo_cf_s ) { printf( '', esc_attr( $key ), checked( 'yes', (string) ( $aieo_cf_s[ $key ] ?? 'no' ), false ), esc_html( $label ), '' !== $aria ? ' aria-label="' . esc_attr( $aria ) . '"' : '', '' !== $help ? ' aria-describedby="' . esc_attr( $help ) . '"' : '' ); }; $aieo_cf_box = static function ( $key, $label ) use ( $aieo_cf_s ) { return sprintf( '', esc_attr( $key ), checked( 'yes', (string) ( $aieo_cf_s[ $key ] ?? 'no' ), false ), esc_html( $label ) ); }; $aieo_cf_row = static function ( $id, $label, $control, $help = '' ) { return \Rooster\Admin\Ui::field_row( array( 'id' => $id, 'label' => $label, 'control' => $control, 'help' => $help ) ); }; $aieo_cf_wpml = AIEO_Contact_Form_Settings::wpml_active() || function_exists( 'pll_register_string' ); $aieo_cf_form = static function ( $card ) { return AIEO_DMM_UI::card_form( 'aieo_dmm_contact_form_save', 'contact_form', 'aieo-card-' . $card . '-form', (string) ob_get_clean() ); }; $aieo_cf_save = static function ( $card, array $opts = array() ) { return class_exists( '\Rooster\Admin\States' ) ? \Rooster\Admin\States::save_button( 'aieo-card-' . $card . '-form', $opts ) : ''; }; list( $aieo_cf_open, $aieo_cf_close ) = AIEO_DMM_UI::card( array( 'anchor' => 'contact-form-placing', 'icon' => 'layout-template', 'title' => __( 'How to place it', 'ai-eshop-optimizer' ), 'description' => __( 'Three ways, all rendering the same form. Each placement can choose its own fields, required fields and layout; anything it leaves blank follows the defaults below.', 'ai-eshop-optimizer' ), ) ); echo $aieo_cf_open; ?> __( 'In the block editor', 'ai-eshop-optimizer' ) ) ) ); \Rooster\Admin\Markup::out( \Rooster\Admin\Guidance::text( __( 'Elementor: drag in the “Contact form (Rooster One)” widget. Same controls.', 'ai-eshop-optimizer' ), 'guidance', array( 'question' => __( 'In Elementor', 'ai-eshop-optimizer' ) ) ) ); ?>

[aieo_contact_form fields="first_name,last_name,email,phone,country,company,message" required="first_name,last_name,email,message" names="inline" rows="6" company_label="Hotel name" title="" intro="" button=""]

'contact-form-settings', 'icon' => 'settings', 'title' => __( 'Contact form settings', 'ai-eshop-optimizer' ), 'description' => $aieo_cf_desc, 'footer' => $aieo_cf_save( 'contact-form-settings', array( 'attrs' => array( 'data-aieo-action' => 'contact_form.save' ) ) ), ) ); echo $aieo_cf_open; ob_start(); ?> ' . $aieo_cf_row( 'aieo-cf-enabled', __( 'Enable', 'ai-eshop-optimizer' ), $aieo_cf_box( 'enabled', __( 'Show the form wherever it is placed', 'ai-eshop-optimizer' ) ), __( 'Place it with [aieo_contact_form], the Contact Form block or the Elementor widget. Switching this off blanks every placement at once.', 'ai-eshop-optimizer' ) ) . $aieo_cf_row( 'aieo-cf-form_title', __( 'Title', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'form_title', (string) $aieo_cf_s['form_title'], array( 'id' => 'aieo-cf-form_title', 'medium' => true, 'placeholder' => __( 'none', 'ai-eshop-optimizer' ) ) ) ) . $aieo_cf_row( 'aieo-cf-form_intro', __( 'Intro line', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'form_intro', (string) $aieo_cf_s['form_intro'], array( 'id' => 'aieo-cf-form_intro', 'placeholder' => __( 'none', 'ai-eshop-optimizer' ) ) ) ) . $aieo_cf_row( 'aieo-cf-button_text', __( 'Button text', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'button_text', (string) $aieo_cf_s['button_text'], array( 'id' => 'aieo-cf-button_text', 'medium' => true, 'placeholder' => $aieo_cf_ph( 'button_text' ) ) ) ) . $aieo_cf_row( 'aieo-cf-success_message', __( 'Success message', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::textarea( 'success_message', (string) $aieo_cf_s['success_message'], array( 'id' => 'aieo-cf-success_message', 'rows' => 2, 'placeholder' => $aieo_cf_ph( 'success_message' ) ) ) ) . $aieo_cf_row( 'aieo-cf-redirect_url', __( 'Redirect after sending', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'redirect_url', (string) $aieo_cf_s['redirect_url'], array( 'id' => 'aieo-cf-redirect_url', 'type' => 'url', 'placeholder' => 'https://' ) ), __( 'Optional. Blank shows the success message in place of the form; a URL (a thank-you page, for conversion tracking) sends the visitor there instead.', 'ai-eshop-optimizer' ) ) . ''; ?> 'contact-form-fields', 'icon' => 'text-cursor-input', 'title' => __( 'Fields', 'ai-eshop-optimizer' ), 'description' => __( 'The defaults for every placement. Email is always shown and always required. A placement (shortcode, block, widget) may choose its own fields and required fields; the choice is signed into the page, so a visitor cannot change it.', 'ai-eshop-optimizer' ), 'footer' => $aieo_cf_save( 'contact-form-fields' ), ) ); echo $aieo_cf_open; ob_start(); ?> __( 'Email', 'ai-eshop-optimizer' ), 'show' => array( 'value' => true ), 'required' => array( 'value' => true ), ), ); foreach ( $aieo_cf_field_labels as $aieo_cf_k => $aieo_cf_label ) { ob_start(); $aieo_cf_check( 'show_' . $aieo_cf_k, '', __( 'Show', 'ai-eshop-optimizer' ) . ', ' . $aieo_cf_label ); $aieo_cf_show = ob_get_clean(); ob_start(); $aieo_cf_check( 'req_' . $aieo_cf_k, '', __( 'Required', 'ai-eshop-optimizer' ) . ', ' . $aieo_cf_label ); $aieo_cf_req = ob_get_clean(); $aieo_cf_grid[] = array( 'field' => (string) $aieo_cf_label, 'show' => array( 'html' => $aieo_cf_show ), 'required' => array( 'html' => $aieo_cf_req ), ); } echo \Rooster\Admin\Ui::table( array( array( 'key' => 'field', 'label' => __( 'Field', 'ai-eshop-optimizer' ), 'type' => 'text' ), array( 'key' => 'show', 'label' => __( 'Show', 'ai-eshop-optimizer' ), 'type' => 'boolean' ), array( 'key' => 'required', 'label' => __( 'Required', 'ai-eshop-optimizer' ), 'type' => 'boolean' ), ), $aieo_cf_grid, array( 'id' => 'aieo-cf-fields-grid' ) ); ?> sprintf( __( 'The shop’s base country (%s)', 'ai-eshop-optimizer' ), '' !== $base_country && isset( $countries[ $base_country ] ) ? $countries[ $base_country ] : '—' ), ) + $countries; $aieo_cf_country = $aieo_cf_row( 'aieo-cf-default_country', __( 'Default country', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::select( 'default_country', $aieo_cf_countries, (string) $aieo_cf_s['default_country'], array( 'id' => 'aieo-cf-default_country' ) ) ); } else { $aieo_cf_country = \Rooster\Admin\Ui::field_row( array( 'label' => __( 'Default country', 'ai-eshop-optimizer' ), 'control' => '

' . esc_html__( 'Without WooCommerce the country is a free-text field.', 'ai-eshop-optimizer' ) . '

', ) ); } echo '
' . $aieo_cf_row( 'aieo-cf-name_layout', __( 'First and last name', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::select( 'name_layout', array( 'inline' => __( 'Side by side (stacked on phones)', 'ai-eshop-optimizer' ), 'stacked' => __( 'One under the other', 'ai-eshop-optimizer' ), ), (string) $aieo_cf_s['name_layout'], array( 'id' => 'aieo-cf-name_layout' ) ) ) . $aieo_cf_row( 'aieo-cf-message_rows', __( 'Message box height (rows)', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'message_rows', (string) (int) $aieo_cf_s['message_rows'], array( 'id' => 'aieo-cf-message_rows', 'type' => 'number', 'xs' => true, 'min' => 3, 'max' => 15, 'step' => 1 ) ) ) . $aieo_cf_row( 'aieo-cf-company_label', __( 'Company field label', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'company_label', (string) $aieo_cf_s['company_label'], array( 'id' => 'aieo-cf-company_label', 'medium' => true, 'placeholder' => $aieo_cf_ph( 'company_label' ) ) ), __( 'For example “Hotel name”.', 'ai-eshop-optimizer' ) ) . $aieo_cf_country . $aieo_cf_row( 'aieo-cf-consent_enabled', __( 'Privacy consent', 'ai-eshop-optimizer' ), $aieo_cf_box( 'consent_enabled', __( 'Require a privacy-policy checkbox', 'ai-eshop-optimizer' ) ) ) . $aieo_cf_row( 'aieo-cf-consent_text', __( 'Consent text', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'consent_text', (string) $aieo_cf_s['consent_text'], array( 'id' => 'aieo-cf-consent_text', 'placeholder' => $aieo_cf_ph( 'consent_text' ) ) ) ) . $aieo_cf_row( 'aieo-cf-consent_link_text', __( 'Words to link', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'consent_link_text', (string) $aieo_cf_s['consent_link_text'], array( 'id' => 'aieo-cf-consent_link_text', 'medium' => true, 'placeholder' => $aieo_cf_ph( 'consent_link_text' ) ) ), __( 'Only the words to link are made clickable. A blank URL uses the WordPress privacy policy page.', 'ai-eshop-optimizer' ) ) . $aieo_cf_row( 'aieo-cf-consent_url', __( 'Privacy policy URL', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'consent_url', (string) $aieo_cf_s['consent_url'], array( 'id' => 'aieo-cf-consent_url', 'type' => 'url', 'placeholder' => (string) get_privacy_policy_url() ) ), __( 'Where the consent box’s words and the privacy line’s words link.', 'ai-eshop-optimizer' ) ) . $aieo_cf_row( 'aieo-cf-privacy_enabled', __( 'Privacy line', 'ai-eshop-optimizer' ), $aieo_cf_box( 'privacy_enabled', __( 'Print a line about how the details are used above the button', 'ai-eshop-optimizer' ) ), __( 'Not printed while the privacy-policy checkbox is on: its own words carry the link.', 'ai-eshop-optimizer' ) ) . $aieo_cf_row( 'aieo-cf-privacy_text', __( 'Privacy line text', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'privacy_text', (string) $aieo_cf_s['privacy_text'], array( 'id' => 'aieo-cf-privacy_text', 'placeholder' => $aieo_cf_ph( 'privacy_text' ) ) ) ) . $aieo_cf_row( 'aieo-cf-privacy_link_text', __( 'Words to link', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'privacy_link_text', (string) $aieo_cf_s['privacy_link_text'], array( 'id' => 'aieo-cf-privacy_link_text', 'medium' => true, 'placeholder' => $aieo_cf_ph( 'privacy_link_text' ) ) ), __( 'Only the words to link are made clickable, to the privacy policy URL above. Without a privacy policy to link, the line is not printed.', 'ai-eshop-optimizer' ) ) . '
'; ?> 'contact-form-emails', 'icon' => 'send', 'title' => __( 'Emails', 'ai-eshop-optimizer' ), 'description' => __( 'Who is emailed when a visitor sends the form, and the thank-you email the visitor receives.', 'ai-eshop-optimizer' ), 'footer' => $aieo_cf_save( 'contact-form-emails' ), ) ); echo $aieo_cf_open; if ( empty( $recipients['emails'] ) && class_exists( '\Rooster\Admin\Ui' ) ) { echo \Rooster\Admin\Ui::notice( '' . esc_html__( 'New messages are emailed to:', 'ai-eshop-optimizer' ) . ' ' . esc_html__( 'nobody. Set a recipient below.', 'ai-eshop-optimizer' ), 'warning', array( 'inline' => true ) ); } else { ?>

—

' . $aieo_cf_row( 'aieo-cf-recipients', __( 'Send new messages to', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'recipients', (string) $aieo_cf_s['recipients'], array( 'id' => 'aieo-cf-recipients', 'placeholder' => __( 'comma separated. Blank falls back to your shop managers', 'ai-eshop-optimizer' ) ) ), __( 'Blank is fine: the notice then goes to your shop managers and administrators, then to the Rooster One contact, then to the WordPress administration address. Replying to it answers the visitor.', 'ai-eshop-optimizer' ) ) . $aieo_cf_row( 'aieo-cf-staff_subject', __( 'Staff email subject', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'staff_subject', (string) $aieo_cf_s['staff_subject'], array( 'id' => 'aieo-cf-staff_subject', 'placeholder' => $aieo_cf_ph( 'staff_subject' ) ) ) ) . $aieo_cf_row( 'aieo-cf-ack_enabled', __( 'Thank-you email', 'ai-eshop-optimizer' ), $aieo_cf_box( 'ack_enabled', __( 'Email the visitor a thank-you, in the language they wrote in', 'ai-eshop-optimizer' ) ) ) . $aieo_cf_row( 'aieo-cf-ack_subject', __( 'Thank-you subject', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::input( 'ack_subject', (string) $aieo_cf_s['ack_subject'], array( 'id' => 'aieo-cf-ack_subject', 'placeholder' => $aieo_cf_ph( 'ack_subject' ) ) ) ) . $aieo_cf_row( 'aieo-cf-ack_body', __( 'Thank-you text', 'ai-eshop-optimizer' ), \Rooster\Admin\Ui::textarea( 'ack_body', (string) $aieo_cf_s['ack_body'], array( 'id' => 'aieo-cf-ack_body', 'rows' => 6, 'placeholder' => $aieo_cf_ph( 'ack_body' ) ) ), __( 'Placeholders: {first_name} {last_name} {email} {phone} {city} {country} {company} {site_name}. A copy of the visitor’s message is added underneath.', 'ai-eshop-optimizer' ) ) . ''; ?> Settings > Emails, where they can be switched off and their heading changed.', 'ai-eshop-optimizer' ); echo class_exists( '\Rooster\Admin\Guidance' ) ? \Rooster\Admin\Guidance::text( $aieo_cf_wc ) : '

' . esc_html( $aieo_cf_wc ) . '

'; echo $aieo_cf_close;