Learn

get_value

Retrieves filtered values from an array

{{ get_value:[field] }}

Allows you to loop over filtered values in an array.

Sample Usage

{{ get_value:categories name="wilderness" from="/blog" }}
    {{ description }}
{{ /get_content:categories }}

This will look in /blog for a categories array, and extract all the instances of name: wilderness.

Assuming your categories array looks like this:

categories:
  -
    name: wilderness
    description: "The place where Statamic was born."
  -
    name: survival
    description: "Tips on how to survive."

The above code would output: The place where Statamic was born.

Parameters

from

Optional. The URL that contains the array. If you leave this blank, it will use the current context.

Filters

Every other parameter will be treated as a filter.

For example, name="wilderness" would look for instances of name: wilderness.
name="wilderness" foo="bar" would look for instances where both name: wilderness and foo: bar exist.

This article was last updated on September 13th, 2016. Find an error? Please let us know!