HTMX: set response header¶
Plugin ID: eca_htmx_response_header
Available since: 3.1.3
Set one of the HTMX HX-* response headers (e.g. redirect, location, push URL, refresh or trigger) on the current response. Reacts to a response event, for example the "Response created" event of the ECA Miscellaneous module or an ECA Endpoint response.
Runs on a response event
This action sets an HTMX HX-* header on the current response, so it must
run in response to a response event such as the
Response created event or an
ECA endpoint response.
The HX-Location header supports its full form through the additional
location fields (source, event, handler, target, swap, values, headers, and
select). See
Building HTMX-powered interfaces with ECA.
Fields¶
Response header— config key:header-
The HTMX response header to set.
When using the "Defined by token" option, make sure there is a token with this name: eca_htmx_response_header_headerType:
select· Required: no · Default:redirectAllowed values:
redirect,location,push_url,replace_url,refresh,retarget,reswap,reselect,trigger,_eca_token,'' Value— config key:value-
The header value. For URL headers provide a URL (internal paths start with a slash); for the refresh header use true or false; for trigger headers provide the event name; for retarget/reswap/reselect provide the CSS selector or swap strategy. For the location header this is the path (URL).
This field supports tokens.Type:
textfield· Required: no · Default: empty string Location: source— config key:location_source-
The source element of the request.
This field supports tokens.Type:
textfield· Required: no · Default: empty string Location: event— config key:location_event-
An event that "triggered" the request.
This field supports tokens.Type:
textfield· Required: no · Default: empty string Location: handler— config key:location_handler-
A callback that will handle the response HTML.
This field supports tokens.Type:
textfield· Required: no · Default: empty string Location: target— config key:location_target-
The CSS selector of the target for the swap.
This field supports tokens.Type:
textfield· Required: no · Default: empty string Location: swap— config key:location_swap-
The swap strategy, for example innerHTML or outerHTML.
This field supports tokens.Type:
textfield· Required: no · Default: empty string Location: select— config key:location_select-
A CSS selector for the content to swap into the target.
This field supports tokens.Type:
textfield· Required: no · Default: empty string Location: values— config key:location_values-
A set of values to submit with the request, as a key-value list in YAML format. Example:
key: value. When using tokens, wrap them as a string. Example: id: "[node:nid]".
This field supports tokens.Type:
textarea· Required: no · Default: empty string Location: headers— config key:location_headers-
Headers to submit with the request, as a key-value list in YAML format. Example:
X-Custom: value. When using tokens, wrap them as a string. Example: X-Custom: "[token]".
This field supports tokens.Type:
textarea· Required: no · Default: empty string