-
Notifications
You must be signed in to change notification settings - Fork 10
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
Method name collisions #4
Comments
Hi @barnabaskecskes , unfortunately, Nova doesn't provide any way for a package to hook into its "life cycle" so in order to archive some functionality we need to "override" some methods that nova will call on its request lifecycle.. but you still can use both packages together by creating subclasses and extending them.. for example: class WithJsonWrapperField extends Resource {
use HasJsonWrapper;
} class WithConditionalContainerField extends WithJsonWrapperField {
use HasConditionalContainer;
} class YourResourceClass extends WithConditionalContainerField
{
public function field()
{
return [
ConditionalContainer::make([
JsonWrapper::make(...)
])
];
}
} |
Thanks for the response. I think this is exactly the same as just dropping the class MyResourceClass
{
use HasConditionalContainer;
public function field()
{
return [
ConditionalContainer::make([
JsonWrapper::make(...)
])
];
}
} |
Without the HasJsonWrapper, your resource won't display correctly on details view What that trait does is, when you are on the detail views it merge all its given fields into a your main fields array, so it display as if there wasn't any json wrapper at all, if you remove it nova will try to render it, but there isn't any detail field definition for json wrapper, so all your nested fields I'll be gone on details view... |
i try to work the whole afternoon, but not works fine together :( very thx. this is my test code. |
Maybe something has changed in the latest version of nova, the project I use both packages together uses nova |
any news for this? @milewski thx |
Also would like a fix for this, using nova version 3. |
If I use the traits from this package and the
dcasia/conditional-container
package as the documentations suggest, the latter trait's methods will be ignored therefore these packages won't play ball with each other. What is your suggestion?The text was updated successfully, but these errors were encountered: