whitecube / nova-flexible-content

Flexible Content & Repeater Fields for Laravel Nova
MIT License
788 stars 231 forks source link

Empty Flexible content #475

Closed Senexis closed 1 year ago

Senexis commented 1 year ago

Currently, when viewing pages, the flexible content is empty.

Details

It seems to be caused by the recent changes for compatiblity with Nova 4.26, but I never had any issues in the first place with it, and now that a call to is_a() is replaced from \stdClass to Fluent, the detection for \stdClass instances is broken.

I don't quite know how or why I don't experience issues in Nova 4.26 with version <1.0.9, but I don't. My layouts still are instances of \stdClass, so removing the check from getMappedLayout in HasFlexible seems to break my installation (getMappedLayout returns null). Reverting back to version 1.0.8 fixes the issue and is fully compatible with my usecase in Nova 4.26.

For posterity and sake of completeness:

Proposed fix

The recent commits removed the check for is_a($item, \stdClass) (HasFlexible.php:125 in 1.0.8). This should be added back in the same elseif as Fluent::class, probably (ex. elseif (is_a($item, Fluent::class) || is_a($item, \stdClass::class))). I am not sure (and not feasibly able to test) whether this breaks things for people that are experiencing issues with >=1.0.9 and 4.26, hence I am not able to comfortably Pull Request.

PieterCappelle commented 1 year ago

Agree, having same issues. Laravel Nova 4.26 and latest version of this module. This breaks the entire module. content is empty after this change.

https://github.com/whitecube/nova-flexible-content/pull/469

mabdullahsari commented 1 year ago

This has been fixed with #474. A patch release has to be tagged now.

Jaspur commented 1 year ago

@mabdullahsari that did not fix it. I upgraded from v1.0.8: Upgrading whitecube/nova-flexible-content (v1.0.8 => v1.0.11)

When using v1.0.8 (and "laravel/nova": "4.25.1",):

Scherm­afbeelding 2023-07-11 om 09 10 43

When using v1.0.11 (and "laravel/nova": "4.26.4"):

Scherm­afbeelding 2023-07-11 om 09 10 06
Senexis commented 1 year ago

@Jaspur It doesn't have a release yet (it would be 1.0.12). For now, you should be able to use dev-master as the composer version to get the changes.

kbellpostman commented 1 year ago

Thanks guys!

toonvandenbos commented 1 year ago

Released in v1.0.12. Thank you for your help everyone!