nova-flexible-content icon indicating copy to clipboard operation
nova-flexible-content copied to clipboard

Fix getMediaModel with nested flexible Layout

Open trippo opened this issue 4 years ago • 11 comments

Instanceof Layout without import return always false and getMediaModel must be public.

trippo avatar Mar 16 '21 09:03 trippo

Hi @trippo,

Is this PR finished or are you still tweaking it ?

Thanks !

toonvandenbos avatar May 26 '21 08:05 toonvandenbos

The last 4 commits are for support validation on translatable fields inside flexible

trippo avatar May 27 '21 15:05 trippo

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.

trippo avatar May 27 '21 15:05 trippo

Can you accept this pull request?

trippo avatar Aug 10 '21 08:08 trippo

@Nyratas please see my changes

trippo avatar Aug 24 '21 12:08 trippo

Any update on this?

pitylee avatar Feb 23 '22 15:02 pitylee

Nope but I'm using @trippo version long time on the production

Fabstilelook avatar Feb 23 '22 16:02 Fabstilelook

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"
                        ]
                    }
                }
            }
        }

pitylee avatar Feb 23 '22 16:02 pitylee

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.

voidgraphics avatar Feb 23 '22 16:02 voidgraphics

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.

pitylee avatar Feb 23 '22 16:02 pitylee

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"}}]

pitylee avatar Feb 24 '22 13:02 pitylee