Commit 09eb39e5 authored by Tim Rogers's avatar Tim Rogers

Added documentation for bl:ref

parent 1ed4f03e
thing
### **bl:ref** ###
```
"bl:map": {
"i0": {
"bl:ref": "/content/fshr/collections/-language/properties/-property",
"nodes": {
"n0": {
"source": "name/propertyName",
"target": "title",
"jcr:primaryType": "nt:unstructured"
},
"jcr:primaryType": "nt:unstructured"
},
"jcr:primaryType": "nt:unstructured"
},
"jcr:primaryType": "nt:unstructured"
}
```
## Description ##
bl:map entry used to reference data from collections and pull it into the targeted node.
## Structure ##
**"bl:map"**: The Map entry on the component/page template
**"i0"**: Container for the bl:ref entry
**"bl:ref"**:
The path to the collections page. Use "-" to denote a variable that will be filled in based on the current page url.
Example, If the Current page is:
`/content/fshr/pages/en/properties/atlanta`
And the bl:ref is:
`"bl:ref": "/content/fshr/collections/-language/properties/-property"`
page referenced will be:
`/content/fshr/collections/en/properties/atlanta`
**"nodes"**
To set the data, a "nodes" container must be created with at least one node ("n0") that has a `source` and `target`
The `source` is the path to the data on the page (excluding "jcr:content").
The `target` is the path to the node that will be set or created on the current node (the node to which bl:map is attached) to hold the returned source data
If more than one field needs to be set from the same source, Multiple nodes may be set via incrementing "nX":
```
"nodes": {
"n0": {
"source": "name/propertyName",
"target": "title",
"jcr:primaryType": "nt:unstructured"
},
"n1": {
"source": "name/propertyShortName",
"target": "shortName",
"jcr:primaryType": "nt:unstructured"
},
"jcr:primaryType": "nt:unstructured"
}
```
Note that the source returned will not have a node name (key), only the value/object found at the path will be returned. If Target is left out, the current node will be used as the target. In this case, the last part of the source path with be used as the node name.
**"jcr:primaryType"**: Always `"nt:unstructured"` and must be entered for each block
## . (dot) Target and Source ##
`.` may be used for the target, source, or both.
Using `.` in Target functions the same as leaving out Target. The current node will be used as the target and the last part of the source path will be used as the node name.
Using `.` in Source will return the entire data structure from the bl:ref (everything in the pages "jcr:content" node).
Using `.` for Both Target and Source will replace the current node with the data structure returned from the bl:ref. This will change the Type of the current node as jcr:ResourceType will be returned
```
"nodes": {
"n0": {
"source": ".",
"target": ".",
"jcr:primaryType": "nt:unstructured"
},
"jcr:primaryType": "nt:unstructured"
}
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment