Invokes code within the tag asynchronously, in the background. You will only have access to variables you explicitly pass to the background tag. The context object is available by default, but with limitations - you need to explicitly pass page/layout metadata if you want to use it, as well as device and constants.
Name | Type | Description |
---|---|---|
options | Hash | Any variable provided to the background tag will become accessible in the code. |
options.delay | Float | Which defines the number of minutes to delay running code (defaults to 0, which means run code as soon as possible). |
options.priority | String | Low, default or high - see AsyncCallbackPriorityEnum GraphQL Object. |
options.max_attempts | Integer | The number of times to re-try a job upon failing. Default is 1, maximum is 5. |
options.source_name | String | Your label of the job to help you identify it. |
Checks if there's a string cached for the given key. If yes, it just returns the value without processing anything inside the cache tag, otherwise, it executes code, and stores the result in the cache. When you hit the page with such code for the first time, the code will be executed and hence it will iterate through the loop and generate random strings. However, then the result of the block will be cached and all the following requests within 20 seconds would not invoke the code - instead, it would just take the value from the cache. The output will not change. When the cache expires, the code will be evaluated again, producing another set of random strings. The cache is automatically invalidated if any changes are applied to any view/translation.
Name | Type | Description |
---|---|---|
key | String | The key which should uniquely identify the cached fragment. |
expire | Integer | Optional. The number of seconds since populating the cache to expiration. |
Stores a block of markup in an identifier for later use. Render it later with yield
tag.
Name | Type | Description |
---|---|---|
name | String | The markups will be stored under this name. |
flush | Boolean | Optional. If the flush parameter is true content_for replaces the blocks it is given instead of appending content to the existing one. |
Set locale in context to a given language.
Name | Type | Description |
---|---|---|
language | String | Language 2 letter. |
Makes variables defined inside partial accessible anywhere via context.exports.`namespace`
Name | Type | Description |
---|---|---|
variable | Any | Variable to be stored inside the namespace. |
namespace | String | Namespace under which variable will be in context.exports. |
Used to generate a html form element for a resource. Use within `form configuration`. Inside the tag you can use `form_builder` variable.
Name | Type | Description |
---|---|---|
html-id | String | Set id attribute in ` |
html-novalidate | String | Add `novalidate` attribute to ` |
html-class | String | Add css class ` |
html-multipart | Boolean | Add `enctype="multipart/form-data"` attribute to `lgt;form enctype="multipart/form-data">` element. Multipart is enabled by default. |
html-data- | attr | [String] add data attribute to ` |
Allows to store a variable returned by a partial. Partial needs to return data with `return` tag. All variables needs to be passed explicitly to function. Variables from upper scope are not visible in function. *Note:* `context` is not available inside the function partial unless explicitly passed as a variable.
Used to execute GraphQL query stored in a file or invoke GraphQL query inline. All arguments provided to the tag will be passed to GraphQL. It returns a hash with the data or the errors that occurred (for example, variable type mismatch, required variable not provided, syntax error) etc.
Name | Type | Description |
---|---|---|
query_name | String | Name of the GraphQL query. For get_users.graphql file name of the query is get_users |
arguments | Hash | Optional. key:value pair(s) which will be passed to GraphQL query. For example, if your query looks like `query my_query($email: String!)`, then you can provide `email: "my-email@example.com"` |
args | Hash|JSON | Optional. Either a Hash or a String of the arguments which will be passed to GraphQL query. See examples below. |
Allows to easily modify a Hash with a syntax same as assign tag.
This tag should be used to render forms defined in forms directory.
Name | Type | Description |
---|---|---|
form_name | String | Name of the form configuration from forms directory. |
id | ID | ID of the resource you want to edit. |
parent_resource_id | String | Name of the resource type, i.e. name of custom_model_type, transactable_type, user_profile_type. |
Print information to environment logs. To view logs run `insites-cli gui serve ` in your application directory and go to `http://localhost:3333/Logs`. If you prefer seeing logs in the terminal, run `insites-cli gui logs `.
Name | Type | Description |
---|---|---|
message | Any | Any object that can be printed. |
type | String | Type of log entry. Use it to tag your logs to make it easier to differentiate logs. If you set it to 'error' insites-cli will also notify your OS about it if your OS supports it. |
env | String | Environment where the entry should be created; can be any of 'all', 'staging', 'production'. Default: 'all' |
Captures and parses the JSON string inside of the opening and closing tags and assigns it to a variable.
Name | Type | Definition |
---|---|---|
variable_name | String | The variable name that will be used to assign contents after it is parsed. |
content | String | Valid JSON string to be assigned. |
Print variable, skipping any additional sanitisation. It provides a way to display a variable which consists of both safe and unsafe html. Warning: Do not use it with data entered by users as it is gonna cause XSS.
Name | Type | Description |
---|---|---|
variable | String | A variable containing safe and potentially unsafe HTML. |
Redirects browser to target
Name | Type | Description |
---|---|---|
target | String | Path or url. |
status | Int | 3xx HTTP code, default 302. |
Allows you to set additional HTTP headers for the response.
Name | Type | Description |
---|---|---|
headers | String | Headers as JSON string, default {}. |
Allows you to set HTTP status for the response. Default 200.
Name | Type | Description |
---|---|---|
status | Int | HTTP status, default 200 |
Used inside a partial invoked by a function tag to return a variable.
Stores data during user's session Sets field of given name to given value in context.session.
Sign in user.
Name | Type | Definition |
---|---|---|
user_id | String | user id |
Generates html for spam protection. Supports Google reCAPTCHA strategies: recaptcha_v2, recaptcha_v3 and hcaptcha.
Name | Type | Description |
---|---|---|
strategy | String | Name of protection strategy. Default is recaptcha_v2. |
action | String | Action name for reCAPTCHA V3, action may only contain alphanumeric characters and slashes |
Allows to specify search paths for theme partials via app/config.yml property "theme_render_paths" Assuming app/config.yml looks like this: theme_search_paths : - theme/{{ context.constants.MY_THEME | default: "custom" }} - theme/simple
Allows to catch errors, especially useful with `liquid_raise_mode: true` setting in app/config.yml.
Execute code wrapped inside content_for
Name | Type | Description |
---|---|---|
name | String | Name of content_for block. |
Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.