=== Doxtly Forms ===
Contributors: doxtly
Tags: forms, embed, doxtly, gutenberg, elementor
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.3.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed Doxtly forms, quizzes and surveys on your WordPress site using shortcodes, Gutenberg blocks, or Elementor widgets, and link to forms, interactive documents, quizzes and surveys.

== Description ==

Doxtly Forms lets you embed forms created with Doxtly on your WordPress website. The plugin provides multiple integration methods to suit your workflow:

* **Shortcode** - Simple shortcode for embedding forms anywhere
* **Gutenberg Block** - Native WordPress block editor support
* **Elementor Widgets** - Doxtly Form and Doxtly Quiz or Survey, drag-and-drop widgets for the Elementor page builder

With a Doxtly access key saved in the settings, the block and the widget let you choose the form from a list of your organization's active forms, instead of typing its ID, and the Doxtly Quiz or Survey block and widget the quiz or survey from a list of the active ones. The link tools of the block editor, the classic editor and Elementor's link fields then also find your active forms, interactive documents, quizzes and surveys by name, and insert a plain link to their public page.

= Features =

* Forms, quizzes and surveys drawn in the page or in an auto-resizing iframe that fits its content
* A Doxtly theme of your organization for each embed, and a transparent background on request
* Fully responsive forms
* Your Doxtly themes and their custom CSS
* Password-protected forms
* Query parameter support
* reCAPTCHA integration
* File uploads
* Multi-page wizard forms
* Conditional logic

= Usage =

**Shortcode:**
`[doxtly_form id="your-form-id" width="100%" min_height="400px"]`

A quiz or survey, by the token of its public link, with the same attributes as a form - in the page by default, or `type="iframe"` for a frame that follows its height:
`[doxtly_quiz id="your-quiz-token"]` or `[doxtly_survey id="your-survey-token" type="iframe"]`

Any of them in another Doxtly theme of your organization, or on the site's own background:
`[doxtly_form id="your-form-id" theme="dark" transparent="true"]`

**Gutenberg Block:**
Search for "Doxtly Form" in the block inserter and choose the form in the block settings, or for "Doxtly Quiz or Survey" to choose a quiz or survey.

**Elementor Widget:**
Drag the "Doxtly Form" widget from the Elementor panel and choose the form in the widget settings, or the "Doxtly Quiz or Survey" widget for a quiz or survey. The blocks and the widgets offer the embed type, isolation from the site's styles, the Doxtly theme and a transparent background for each of them.

== Installation ==

1. Upload the `doxtly-forms` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to Settings > Doxtly Forms and enter your Doxtly application URL (if you use your own subdomain)
4. Optionally, create an access key in Doxtly with the "List forms" permission, "List interactive documents" to link to those as well, and "List quizzes" and "List surveys" for quizzes and surveys, and save its API key and secret in the same settings, to choose them from a list and find them in the link tools
5. Add "Read themes of public pages" to the access key to choose a Doxtly theme from a list in the blocks and widgets
6. Use the shortcode, Gutenberg block, or Elementor widget to embed your forms

== Frequently Asked Questions ==

= Where do I find my form ID? =

Your form ID can be found in the Doxtly dashboard. It's the unique identifier in the form URL (e.g., `/f/abc-123` - the ID is `abc-123`).

= How is the access key stored? =

Encrypted (libsodium secretbox), with a key derived from DOXTLY_FORMS_ENCRYPTION_KEY when wp-config.php defines it, and otherwise from the site's LOGGED_IN_KEY and LOGGED_IN_SALT. When wp-config.php sets neither of those, WordPress keeps them in the database, next to the encrypted key, so the plugin saves no access key and stops using one saved earlier: define DOXTLY_FORMS_ENCRYPTION_KEY (or set LOGGED_IN_KEY and LOGGED_IN_SALT) in wp-config.php and enter the key again. Only WordPress uses it, to list forms and interactive documents for the editors: it is never sent to the browser. If the security keys in wp-config.php change, the saved key can no longer be decrypted and has to be entered again.

= Why can't I type the form ID when the list is shown? =

With an access key saved, the form is chosen from the active forms Doxtly lists, so a mistyped or draft form cannot be placed on a page. The ID can be typed only without an access key, or while the list cannot be loaded. A form saved earlier that is no longer on the list (deleted, deactivated, or from another organization) is kept, and shown as unavailable with a warning, until another one is chosen.

= How do I link to a form or an interactive document? =

With an access key saved, add a link the way you always do and type the name: active forms, interactive documents, quizzes and surveys are found next to your pages and posts, labelled "Doxtly form", "Interactive document", "Doxtly quiz" and "Doxtly survey", and the address of their public page goes in. This works where WordPress searches for a link in the block editor (text, buttons, images, navigation), in the classic editor, and in the link fields of Elementor's classic widgets. Elementor's Atomic elements search their own way and cannot be reached: paste the address there. The key needs "List forms" for forms, "List interactive documents" for interactive documents, "List quizzes" for quizzes and "List surveys" for surveys. What goes in is a plain link, so it keeps working if the plugin is removed. Nothing is added to what visitors load.

= Is the plugin translated? =

Yes, into Polish, Spanish (Spain), German, Portuguese (Portugal) and French (France). The settings, the block, the widget and their messages are shown in one of these to a user whose language it is, and in English otherwise. The language of a form itself is set in the shortcode, block or widget, and otherwise follows the visitor's browser.

= Can I customize the form appearance? =

Yes. Give the form, quiz or survey a theme in Doxtly (Organization > Themes): its colours, font and custom CSS apply to the embed automatically. To show one embed in another theme of your organization, choose it under "Doxtly theme" in the block or widget, or add `theme="…"` to the shortcode; "Transparent background" lets the site's own background show behind it.

= Does this work with Elementor? =

Yes! The plugin includes a native Elementor widget that you can drag and drop onto your pages.

= Is the form responsive? =

Yes, all embedded forms are fully responsive and will adapt to different screen sizes.

== Screenshots ==

1. Shortcode usage example
2. Gutenberg block in the editor
3. Elementor widget configuration
4. Settings page

== Changelog ==

= 0.3.0 =
* Embed quizzes and surveys: the Doxtly Quiz or Survey block and Elementor widget choose one from a list, and the [doxtly_quiz] and [doxtly_survey] shortcodes place one by the token of its public link
* The link tools also find your active quizzes and surveys by name
* Quizzes and surveys are drawn in the page like forms, or in an iframe: the blocks, the widgets and the shortcodes offer the same embed type and isolation from the site's styles for each
* Choose a Doxtly theme of your organization for a form, a quiz or a survey, and a transparent background, in the blocks and widgets (`theme` and `transparent` in the shortcodes)

= 0.2.0 =
* Link to a form or an interactive document from WordPress's own link tools: in the block editor, the classic editor and Elementor's link fields, type its name and its public address goes in
* The settings say what each permission of the access key gives, and the connection check reports forms and interactive documents apart

= 0.1.0 =
* Settings page redesigned: connection, access key and embedding help in separate cards
* Doxtly access key (API key and secret) in the settings, stored encrypted, with a connection check
* Gutenberg block and Elementor widget: choose the form from a list of active forms, with a refresh button
* Forms no longer on the list are flagged as unavailable instead of being replaced silently
* Optional API URL for installations whose address has no "app" label
* The plugin removes its settings when it is deleted
* Polish translation of the settings, the block, the widget and their messages
* A form with a fixed width no longer runs off a phone's screen

= 1.0.0 =
* Initial release
* Shortcode support
* Gutenberg block
* Elementor widget
* Settings page for base URL configuration

== Upgrade Notice ==

= 0.3.0 =
Embed Doxtly quizzes and surveys with a block, an Elementor widget or a shortcode, in the page or in an iframe, each in the Doxtly theme you choose. Choosing them from a list needs the "List quizzes" and "List surveys" permissions on the access key, and choosing a theme "Read themes of public pages".

= 0.2.0 =
Find your forms and interactive documents by name in the editors' link tools. Linking to interactive documents needs the "List interactive documents" permission on the access key.

= 0.1.0 =
Choose forms from a list in the block editor and Elementor after saving a Doxtly access key in Settings > Doxtly Forms.

= 1.0.0 =
Initial release of Doxtly Forms plugin.
