(string) ($settings['name_label'] ?? 'Name'), 'email' => (string) ($settings['email_label'] ?? 'Email'), 'message' => (string) ($settings['message_label'] ?? 'Message'), ]; $button = (string) ($settings['button_text'] ?? 'Send message'); $success = (string) ($settings['success_message'] ?? ''); $zx_error = (string) ($settings['error_message'] ?? ''); $attrs = preg_replace('/class="/', 'class="' . ($show_labels ? '' : 'zx-form-basic--no-labels ') . 'zx-form-basic--idle ', $attrs, 1); $attrs .= ' action="' . esc_url($zx_action) . '" method="post" novalidate data-zx-post="' . esc_attr((string) $zx_post_id) . '"'; $attrs .= ' data-zx-success="' . esc_attr($success) . '" data-zx-error="' . esc_attr($zx_error) . '"'; $field = static function (string $zx_name, string $label, string $control) use ($uid, $show_labels): string { $zx_id = $uid . '-' . $zx_name; $html = '
'; $html .= ''; $html .= str_replace('{id}', esc_attr($zx_id), $control); return $html . '
'; }; $zx_html = '
\n" . $field('name', $labels['name'], '') . $field('email', $labels['email'], '') . $field('message', $labels['message'], '') . '' . "\n" . '\n" . '
' . "\n" . "
\n"; echo wp_kses($zx_html, \Zadex\Frontend\Kses::allowed_html());