-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from infinum/feature/docs
docs
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
id: country-list | ||
title: Country list | ||
--- | ||
|
||
*Coming soon* | ||
|
||
![Country list screen](/img/forms/country.webp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
id: helpers | ||
title: Helpers | ||
--- | ||
|
||
Eightshift Forms offers static helpers that can be implemented in your project. The key difference between these helpers and filters is that you can use the former in your theme or plugin code regardless of the load cycle. | ||
|
||
### esFormsGetFormIdByName | ||
|
||
This function retrieves the custom, unique name of a form, as set in the Form settings, from the provided form ID. It's useful when applying specific settings to one or more forms using filters in your project. | ||
|
||
Form identification by name (instead of the default "by ID"), can be useful if switching environments when the form ID could change. | ||
|
||
```php | ||
if (\function_exists('esFormsGetFormIdByName')) { | ||
echo esFormsGetFormIdByName('<form-id>'); | ||
} | ||
``` | ||
|
||
### esFormsDecryptor | ||
|
||
This helper provides decrypt and encrypt methods for variations set in the Form settings, passed to the "Thank you" page after form submission. | ||
|
||
```php | ||
if (\function_exists('esFormsDecryptor')) { | ||
$variation = isset($_GET['es-variation']) ? \esFormsDecryptor(\sanitize_text_field(\wp_unslash($_GET['es-variation']))) : ''; | ||
} | ||
``` | ||
|
||
### esFormsGeolocationCountriesList | ||
|
||
This method generates a list of countries available in the geolocation API and country fields. | ||
|
||
```php | ||
if (\function_exists('esFormsGeolocationCountriesList')) { | ||
$countriesList = esFormsGeolocationCountriesList(); | ||
} | ||
``` | ||
|
||
### esFormsGetSelectOptionsArrayFromString | ||
|
||
This helper parses the block grammar output (that the Gutenberg editor generates) for block options, making it easy to use them in your projects. | ||
|
||
```php | ||
if (\function_exists('esFormsGetSelectOptionsArrayFromString')) { | ||
$select = esFormsGetSelectOptionsArrayFromString('<options>'); | ||
} | ||
``` | ||
|
||
### esFormsGetComponentsRender | ||
|
||
This helper allows you to access the Eightshift Forms component `render` method, enabling you to utilize all Forms components in your projects. If you already have a style set for the selected component, you can use this helper to render it with all the necessary data and styling applied. | ||
|
||
A list of all components can be found [here](https://github.com/infinum/eightshift-forms/tree/develop/src/Blocks/components). | ||
|
||
```php | ||
if (\function_exists('esFormsGetComponentsRender')) { | ||
$render = esFormsGetComponentsRender('<component>', '[<attributes>]'); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.