Skip to content

Commit

Permalink
Merge ee8a567 into d224cff
Browse files Browse the repository at this point in the history
  • Loading branch information
emcarru committed May 9, 2017
2 parents d224cff + ee8a567 commit 236f3f2
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,63 @@ As a result, the following two fields are added to all posts:

These field can be accessed as usual through the ACF functions `get_field()` and `get_fields()`.

### Conditional logic

Conditional logic can be added to a field in the same way as in ACF. The exception is that we can pass `fieldPath` instead of `field`. The `fieldPath` must reference the name of a field defined in the same config:

```json
{
"label": "Show Content Field",
"name": "showContentField",
"type": "true_false"
},
{
"label": "Content",
"name": "contentHtml",
"type": "wysiwyg",
"conditional_logic": [
[
{
"fieldPath": "showContentField",
"operator": "==",
"value": "1"
}
]
]
}
```

To reference a field in conditional logic when inside a nested sub field (for example, in a repeater), the `fieldPath` must be passed relative to the current level. For example:

```json
{
"label": "Show Content Field",
"name": "showContentField",
"type": "true_false"
},
{
"label": "Content Repeater",
"name": "contentRepeater",
"type": "repeater",
"sub_fields": [
{
"label": "Content",
"name": "contentHtml",
"type": "wysiwyg",
"conditional_logic": [
[
{
"fieldPath": "../showContentField",
"operator": "==",
"value": "1"
}
]
]
}
]
}
```

## API

### ACFComposer\ACFComposer (class)
Expand Down

0 comments on commit 236f3f2

Please sign in to comment.