Skip to content

Commit a6ecf92

Browse files
Add documentation
1 parent ac07ddb commit a6ecf92

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,51 @@ prototype(Your.Package:Component) {
7575

7676
## Notes
7777
- The methods are designed to handle both identifiers and object instances for collections and tags.
78-
```
78+
79+
## CodeQ.AssetCacheTag EelHelper
80+
81+
The `CodeQ.AssetCacheTag` EelHelper provides utility methods for generating cache tags for assets, asset collections, and tags in Neos CMS. These methods are designed to be used in Eel expressions and help manage caching effectively.
82+
83+
### Methods
84+
85+
#### `CodeQ.AssetCacheTag.assetTag(array|Asset $assets): array<string>`
86+
Generates cache tags for a given asset or an array of assets.
87+
88+
- **Parameters**:
89+
- `array|Asset $assets`: A single `Asset` object or an array of `Asset` objects.
90+
- **Returns**: An array of cache tags for the provided assets.
91+
92+
---
93+
94+
#### `CodeQ.AssetCacheTag.assetCollectionTag(AssetCollection $assetCollection): string`
95+
Generates a cache tag for a given asset collection.
96+
97+
- **Parameters**:
98+
- `AssetCollection $assetCollection`: The asset collection for which the cache tag is generated.
99+
- **Returns**: A string representing the cache tag for the asset collection.
100+
101+
---
102+
103+
#### `CodeQ.AssetCacheTag.assetTagsCachingTag(array|Tag $tags): array<string>`
104+
Generates cache tags for a given tag or an array of tags.
105+
106+
- **Parameters**:
107+
- `array|Tag $tags`: A single `Tag` object or an array of `Tag` objects.
108+
- **Returns**: An array of cache tags for the provided tags.
109+
110+
---
111+
112+
### Usage Example
113+
114+
You can use the `CodeQ.AssetCacheTag` EelHelper in your Fusion code as follows:
115+
116+
```fusion
117+
prototype(Your.Package:Component) {
118+
@cache {
119+
entryTags {
120+
0 = ${CodeQ.AssetCacheTag.assetTag(asset)}
121+
1 = ${CodeQ.AssetCacheTag.assetCollectionTag(assetCollection)}
122+
2 = ${CodeQ.AssetCacheTag.assetTagsCachingTag(tags)}
123+
}
124+
}
125+
}

0 commit comments

Comments
 (0)