Skip to content

Document new $parent (and updated $root) syntax for field conditions #1502

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

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions content/collections/docs/conditional-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,18 @@ if:

## Field Context

By default, conditions are performed against values in the current level of `fields` in your blueprint. If you need access to values outside of this context (eg. if you are in a replicator, trying to compare against fields outside of the replicator), you can access root VueX store values by prepending your field with `root`:
By default, conditions are performed against values in the current level of `fields` in your blueprint. If you need access to values outside of this context (eg. if you are in a replicator, trying to compare against fields outside of the replicator), you can access parent field values by prepending your field with `$parent`:

```yaml
if:
root.favorite_foods: includes bacon
$parent.favorite_foods: includes bacon
```

You can also access values at the top-level of your blueprint with `$root`:

```yaml
if:
$root.favorite_foods: includes bacon
```

## Custom Logic
Expand Down