From 8dc813500f57f5ca184d38afbee9e537c3549e66 Mon Sep 17 00:00:00 2001 From: Vyygir Date: Thu, 6 Feb 2025 18:35:27 +0000 Subject: [PATCH 1/2] Update get variable docs to show variable key example --- content/collections/variables/get.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/content/collections/variables/get.md b/content/collections/variables/get.md index 6cd41bf98..b655a17f9 100644 --- a/content/collections/variables/get.md +++ b/content/collections/variables/get.md @@ -57,3 +57,17 @@ Be sure to escape these values with the `sanitize` modifier if you plan to use t {!! Statamic::modify(request()->get('jeggings'))->sanitize() !!} ``` :: + +Accessing keys dynamically in Antlers can be done by wrapping the key with `[]`. + +```antlers +{{ show_key = "show" }} +{{ hide_key = "hide" }} +{{ get[show_key] }} +{{ get[hide_key] }} +``` + +```html +pants +jeggings +``` From 8249b5cacfdd2c7bac44ac3ce60c0286b6842941 Mon Sep 17 00:00:00 2001 From: Vyygir Date: Thu, 6 Feb 2025 18:37:11 +0000 Subject: [PATCH 2/2] Better language explanation --- content/collections/variables/get.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/collections/variables/get.md b/content/collections/variables/get.md index b655a17f9..53522a76e 100644 --- a/content/collections/variables/get.md +++ b/content/collections/variables/get.md @@ -58,7 +58,7 @@ Be sure to escape these values with the `sanitize` modifier if you plan to use t ``` :: -Accessing keys dynamically in Antlers can be done by wrapping the key with `[]`. +Accessing `GET` values with a variable key in Antlers can be done by wrapping the key with `[]`. ```antlers {{ show_key = "show" }}