__( '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 '
—
' . esc_html( $aieo_cf_wc ) . '
'; echo $aieo_cf_close;