nova-flexible-content
nova-flexible-content copied to clipboard
Fix getMediaModel with nested flexible Layout
Instanceof Layout without import return always false and getMediaModel must be public.
Hi @trippo,
Is this PR finished or are you still tweaking it ?
Thanks !
The last 4 commits are for support validation on translatable fields inside flexible
But I don't know if there are others methods... Practically in getParsedFlexibleGroup function, convert valid JSON with locales attributes to array and this fixes the validation. If there is a JSON field with a locale attribute like { "en": "bla bla"} this will generate a mistake but it is an unlikely condition.
Can you accept this pull request?
@Nyratas please see my changes
Any update on this?
Nope but I'm using @trippo version long time on the production
It is pretty sad that despite the collaboration from the community they have so many PR stacked.
Is his version on packagist too?
Not packagist, but in composer.json can do like so than install:
"repositories": {
...
"trippo/nova-flexible-content": {
"type": "package",
"package": {
"name": "trippo/nova-flexible-content",
"version": "1.0",
"source": {
"url": "https://github.com/trippo/nova-flexible-content.git",
"type": "git",
"reference": "origin/patch-1"
},
"autoload": {
"psr-4": {
"Whitecube\\NovaFlexibleContent\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Whitecube\\NovaFlexibleContent\\FieldServiceProvider"
]
}
}
}
}
Please see https://github.com/whitecube/nova-flexible-content/discussions/326
We would love to get things moving with this but need someone to help us review these PRs.
I used the actual code fore translatable rule fix, and is working like a charm. At least the validation part, but rhe error showing part on the frontend is not because translatable will have layout key only on frontend.
The media part don't know.
Somehow the translatable field will not get the unique key in the payload.
This way, it is trying to find with files.0.attributes.transcript.en in the rules, but that doesn't exist, if I add the key in the scoped field rules it will not be able to check, but shows error correctly.
I am wondering how could I add the jPsvC4afdJP8SRv0 to the transcript attribute in the payload?
Payload:
files: [{"layout":"audio","key":"jPsvC4afdJP8SRv0","attributes":{"transcript":"{\"en\":\"\",\"fr\":\"fr\"}","jPsvC4afdJP8SRv0__id":"117","jPsvC4afdJP8SRv0__filetype":"audio","jPsvC4afdJP8SRv0__ComputedField":"29582"}}]