Closed apexdodge closed 1 year ago
This actually works, amazing Messing around, here's a sample:
{{ get_content_item_by_id(Target.Id).PublishedContent.content.Text }}<br/>
{% assign items = get_content_items('zBBZ9vQe90yDvUe7-jPsxQ', 'pages') %}
{{ items | json }}
Still WIP - I think the get_content_items functionality should work with the View's developer name instead of viewId, but almost there. Should also support pagination, but almost there. Can be done for v1.0.4.
Preferred
{{ get_content_item_by_id(Target.Id).PublishedContent.content.Text }}<br/>
{% assign items = get_content_items(ContentType='posts', Filter="contains(PrimaryField, 'Home')", PageSize=1) %}
{{ items | json }}
To be released with v1.0.4
There are use cases where it would be very beneficial to be able to make additional calls to pull content once you are rendering the template.
By the default, the data tied to the template is either a list view or a detail view of the item you are targeting. However, what if we want to add a a sidebar on the template that dynamically pulls content items, or maybe a dynamic header / footer nav. Currently, all these other elements would need to be hardcoded, or the developer would have to create their own fork and add in the functionality. It would be great if this was baked in functionality.
The problem is, I'm not 100% sure how to do this, research is needed.
I think we need to:
1) Create some helper functions as described here: https://github.com/sebastienros/fluid#extensibility like
get_content_item_by_id(...)
andget_content_items(...)
2) Add the functionality to RenderEngine.cs https://github.com/RaythaHQ/raytha/blob/9c3510ef3bdd14a0fce58bfdeb8fe00e5d86704e/src/Raytha.Web/Services/RenderEngine.cs#L39 -- now we are already injecting IRelativeUrlBuilder, so in theory, if we are able to inject IMediator, then maybe we can make database calls?