Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x] Add keys and values modifiers #10185

Merged
merged 4 commits into from
May 24, 2024

Conversation

godismyjudge95
Copy link
Contributor

This PR adds two modifiers keys and values to complement the already robust array of array modifiers (ie. flip, flatten, sort, etc.)

Example Data:

$data = [
    'key1' => 'Value 1',
    'key2' => 'Value 2',
];

Example Template:

{{ data | keys | to_json }}

{{ data | values | to_json }}

Example Output:

['key1', 'key2']

['Value 1', 'Value 2']

@jasonvarga jasonvarga merged commit 6a62bb6 into statamic:5.x May 24, 2024
16 checks passed
@godismyjudge95 godismyjudge95 deleted the add-values-keys-modifiers branch May 24, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants