Download the PHP package jacksleight/statamic-distill without Composer
On this page you can find all versions of the php package jacksleight/statamic-distill. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package statamic-distill
Distill
This Statamic addon allows you to filter, fetch or index the individual values, sets and relations within your entries, from both root and deeply nested fields. It's useful for things like:
- Extracting the text from every Bard field within a replicator
- Finding every asset in the page, or just the first image
- Filtering, sorting and paginating a Grid field or raw array just like a collection
- Adding individual sections of a page to a search index
- Refactoring nested data and sets
Installation
You can search for this addon in the Tools > Addons
section of the Statamic control panel and click install, or run the following command from your project root:
Examples
Find every image in the page
Extract all Bard text from a page builder
Filter, sort and paginate a Grid field
Usage
Distill recursively walks through the value you provide looking for items that match your criteria. It can find individual paragraphs and field values through to entire sets and references to other content.
For optimal performance you should use the from
, path
, expand
, limit
and max_depth
parameters to restrict where it goes based on what you're looking for. These options don't just filter the final result, they tell Distill where to look and when to stop.
Distill can find references to other entries, terms, assets and users, but it will not walk into those objects. Additionally Distill will only walk raw values if you provide one, it will not walk into a field's raw value.
Distill Tag
The {{ distill:* }}
tag accepts the following parameters:
- from (string)
The name of the source variable (not the variable itself), can be a single field or raw value or an entry, term, asset or user. - type (string|array)
The type to match, asterisks can be used as a wildcard and multiple types can be pipe delimited, options are:value:[fieldtype]
- A field valueset:[handle]
- A Replicator or Bard setrow:[distill-type]
- A Grid row (type can be defined in the field config)node:[type]
- A Bard nodemark:[type]
- A Bard markentry:[collection]
- An entryterm:[taxonomy]
- A termasset:[container]
- An assetuser
- A userraw:[php-type]
- A raw value
- path (string|array)
The path to match, asterisks can be used as a wildcard and multiple paths can be pipe delimited, paths themselves are dot delimited. - depth (integer)
Sets bothmax_depth
andmin_depth
. - min_depth (integer)
The minimim depth to find items from. - max_depth (integer)
The maximum depth to find items from. - unique (boolean, false)
Filter out duplicate items. Filtering is only applied to these types:entry
term
asset
user
- expand (string|array, all)
Which types to expand and walk into, asterisks can be used as a wildcard and multiple types can be pipe delimited, options are:set:[handle]
row:[distill-type]
value:replicator
value:bard
value:grid
value:entries
value:terms
value:assets
value:users
raw:array
raw:object
- limit (integer)
The maximum number of items. - offset (integer)
The starting item offset. - paginate (integer)
Enables pagination and sets the number of items per page. - sort (string)
The sort order. - include_source (boolean, false)
Whether to include the source value. - still (string)
Which still to apply, multiple stills can be pipe delimited. - [conditions] (mixed)
Any where conditions.
Each item returned includes an info
object that contains the following values:
- type - Type of the item.
- path - Path to the item from the source.
Sponsoring
This addon is completely free to use. However fixing bugs, adding features and helping users takes time and effort. If you find this addon useful and would like to support its development any contribution would be greatly appreciated. Thanks! 🙂