-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nova Flexible Content #17
Comments
Currently it doesn't work with flexible content |
Yep, that's why i tried Nova Dependency Container but I encountered 2
issues with that package too :
- The conditional field doesn't show on the detail view
- Some values are overwritten by the last item of the layout
I've seen you used that package too, do these issues ring a bell to you ?
Thanks.
Le sam. 14 déc. 2019 à 02:34, Rafael Milewski <[email protected]> a
écrit :
… Currently it doesn't work with flexible content
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#17?email_source=notifications&email_token=AEV5PSOYN3CPZ25FQU3FBOTQYQZ23A5CNFSM4J2O6QCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG3WQSQ#issuecomment-565667914>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEV5PSJZRTECFPWA5OZNMJTQYQZ23ANCNFSM4J2O6QCA>
.
|
Yeah I used that package before too but had too many issues for my use case so I built this one instead, I have seen how the |
@dividy I got it almost working and I had pushed my proof of concept to a branch called flexible field, it works on create, on update and on details view as expected, however validation is still broken :( |
Wow.. This sounds like a great step forward to something functional ;-) |
Just did a composer require digital-creative/conditional-container:dev-flexible-content Tried the package, and I'm still having an issue inside Flexible Content... Here's the code, can you try it on your side and tell me if it works ?
|
On my side, it never works, and displays all the fields when I select 'R - Relevé'.. Strange ;) |
@milewski I just used the branch as well and tried the code of @dividy but i get
And I even dont see the fields. I also tried my own, simpler example with the same result: Flexible::make("Data")
->addLayout("Simple Layout", "html", [
Select::make("Type", "type")->options([
"html" => "HTML",
"plain" => "Plaintext"
]),
ConditionalContainer::make([
Trix::make('Content', 'html_content')
])->if('type = html'),
ConditionalContainer::make([
Textarea::make('Content', 'plain_content')
])->if('type = plain')
]) |
The |
@bernhardh I just fixed the issues with your example you can try again it should be working perfectly now (but without validation of course) Form ViewDetail View |
@dividy your example also works now for me... I think the issue were you forgot the trait |
Oh. So stupid. Thank you! Now I get
The if ($flexibleContent->isNotEmpty()) {
$this->registerFlexibleMacros($request, $flexibleContent);
} is false, so this macro is never added? |
whats the endpoint nova is trying to hit that throws that error |
It occurs on edit and detail page. And the endpoint throwing it is On
|
Btw. I am on Ok, found it out, that if I don't use the https://github.com/eminiarts/nova-tabs package, than it works. Wrapping it into it, throws the error. The same goes with https://github.com/armincms/json package. It seems, that the FlexibleContent Element has to be on top Level? |
Oh I see when you use the nova-tabs the "flexible" content is not found, so the macros are not added to it, that's why it crashes, I think it might be possible to detect, I think it is possible to add a check and see if its an instance of panel and recursively try to find flexible contents within its children |
Ok, at least I can fix the issue with the tabs package (and all other packages based on In HasConditionalContainer.php:460 just add if($field instanceof Panel && $field->data) {
return $this->findAllFlexibleContentFields($field->data);
} |
Ah ok let me add |
Pushed |
Ok, now it only worked on empty data. After save i get
To fix this change $field::macro('generateFieldName', static function (array $fields) { to $field::macro('generateFieldName', function (array $fields = []) { Not sure why it is decleared static in the first place? Or does this have any sideeffects? |
That was a mistake, I didn't know macros wouldnt run in static context, I have removed it and pushed again |
Thank you very much, for your help, this package (and |
Good job guys, I watched all the action from far away, getting spammed by notifications. I had to deliver the application to my customer, so I finally chose another working option, I used different presets instead of conditional fields. However, great work! |
@dividy Can I know what you use in order to fix this issue? |
this is the part where you check the fields for creation? i have able to make the validation work for flexible but got other issue.
this will make all price_rent will required https://github.com/anditsung/conditional-container/tree/flexible-content |
Hello,
Is it compatible with Nova Flexible Content ?
I tried it and had a JS error..
Thanks !
The text was updated successfully, but these errors were encountered: