Comments (9)
Hi,
we are currently using RECORDS for this kind of 'nested' rendering.
fields {
content {
fields {
boxes = COA
boxes {
stdWrap.innerWrap = [|]
10 = RECORDS
10 {
source.field = tx_extension_box_item
tables = tx_extension_box_item
conf.tx_extension_box_item.stdWrap.wrap = |###BREAK###
}
stdWrap.split {
token = ###BREAK###
cObjNum = 1 |*|2|*| 3
1.current = 1
1.stdWrap.wrap = |
2.current = 1
2.stdWrap.wrap = ,|
3.current = 1
3.stdWrap.wrap = |
}
}
}
}
}
then, tx_extension_box_item has it's own typoscript JSON template
I will add this example to documentation.
from headless.
But doesn't this also just output all the database tables?
from headless.
Why? I specify table, specify source field, and then i specify tx_extension_box_item in typoscript as JSON and render all required properties
from headless.
Thanks for your example.
But doesn't this also just output all the database tables?
Sorry I meant "columns" not "tables" :)
How do you "specify tx_extension_box_item in typoscript"? With tt_content.*
?
I was especially thinking about a generic way of getting the fields of a table in a defined JSON structure without always using CONTENT
/RECORDS
with stdWrap.wrap
, stdWrap.split
and stdWrap.innerWrap
.
For now I use the following for getting the pages (but it feels quite hacky):
fields {
content {
fields {
pages = COA
pages {
stdWrap.innerWrap = [|]
10 = CONTENT
10 {
table = pages
select {
pidInList.field = pages
orderBy = sorting
recursive.field = recursive
}
renderObj =< lib.page
renderObj.stdWrap.wrap = |###BREAK###
}
stdWrap.split {
token = ###BREAK###
cObjNum = 1 |*|2|*| 3
1.current = 1
1.stdWrap.wrap = |
2.current = 1
2.stdWrap.wrap = ,|
3.current = 1
3.stdWrap.wrap = |
}
}
}
}
}
best,
RamΓ³n
from headless.
I specify tx_extension_box_item without tt_content as it's not tt_content
tx_extension_box_item =< lib.contentElement
tx_extension_box_item {
fields {
content {
fields {
header = TEXT
header {
field = header
}
bodytext = TEXT
bodytext {
field = bodytext
parseFunc =< lib.parseFunc_links
}
link = TEXT
link {
field = link
typolink {
parameter {
field = link
}
returnLast = url
}
}
}
}
}
}
I agree that we should find some simpler way to render those nested properties
from headless.
Ah okay. This is what was confusing me :) Thanks for clearing it up. π
What about a modified DatabaseQueryProcessor
where you can additionally define fields
to to map the JSON fields to database columns.
Something like:
fields {
myRecords {
dataProcessing {
10 = FriendsOfTYPO3\Headless\DataProcessing\JsonRecordsProcessor
10 {
pidInList =
recursive =
selectFields =
languageField =
where =
...
# fields with stdWrap applied (without defining Content Object)
fields {
myCustomLink {
field = link
typolink {
parameter {
field = link
}
returnLast = url
}
}
myCustomId.field = uid
myCustomText.field = bodytext
}
}
}
}
}
Output:
{
"myRecords": [
{
"myCustomLink": "/target/page",
"myCustomId": 2,
"myCustomText": "my bodytext"
},
{...},
{...}
]
}
Just an idea. :)
from headless.
Personally I like this idea, because actual solution is a bit tricky (I don't like this part with |###BREAK###), solution with DataProcessor looks much cleaner.
from headless.
Thanks for your feedback. I will open a PR for this issue soon.
from headless.
I think JsonRecordsProcessor is great idea. We should create one on upcoming sprint.
from headless.
Related Issues (20)
- Add "early if" for JSON cObjects
- Content Element with uid "xxxx" and type "xxxx" has no rendering definition! HOT 11
- FileProcessor: Exception in FileUtility while getting property width on a non-image file HOT 5
- Make some fields of JSON cObject optional
- Question about MenuSitemap and MenuSitemapPages
- Menu content elements don't output rendered tt_content JSON HOT 2
- Image on demand service HOT 8
- Preview Mode not working anymore
- v4.2.2 breakes Form json with "HEADLESS_INT_START<<" and ">>HEADLESS_INT_END" marker in TYPO3 v12 and PHP 8.2. HOT 5
- `frontendBase` ignored in SiteLanguages HOT 5
- AfterCacheableContentIsGeneratedListener overwrites TYPOSCRIPT generated meta title. HOT 6
- Unexpected `frontendBase` configuration behavior HOT 1
- Add integration with Crowdin to handle translations
- Unclear Documentation regarding Preview of Hidden Pages HOT 5
- No categories in Standard CEs HOT 4
- Custom validation errors ignored in EXT:form JSON output HOT 1
- Workspace preview uses backendUrl because headlessMode->isEnabled returns false
- Contribution of EXT:headless_mask & EXT:headless_blog HOT 2
- Output of the title of the backend layout instead of the id HOT 4
- Option for JSON to return null instead of empty array HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from headless.