Open keroth- opened 4 years ago
Hi @keroth-,
Could you post an example of the content you're submitting (the $request->input('content')
) when using the "wysiwyg" & "video" layouts ? Thanks.
HI @Nyratas ! Thank you for your reply.
Here the content data sent (retrieved in DevTools Network tab) :
[
{
"layout":"wysiwyg",
"key":"618b5a16c8f9ab88",
"attributes":{
"618b5a16c8f9ab88__title":"Content title",
"618b5a16c8f9ab88__content":"Contenu"
}
},
{
"layout":"video",
"key":"0odp61vyhire0b8mrawoed6f-video",
"attributes":{
"0odp61vyhire0b8mrawoed6f-video__title":"Video title",
"0odp61vyhire0b8mrawoed6f-video__video":"",
"0odp61vyhire0b8mrawoed6f-video__caption":""
}
}
]
The others datas are:
title: Test
template: about
___nova_flexible_content_fields: ["content"]
_method: PUT
_retrieved_at: 1578498771
Thanks for your help!
Was the "wysiwyg" previously saved or was it a fresh addition ?
I don't remember. I think it was a previous resource. To be sure, I deleted my resource. Here the request datas for a new resource:
title: Test
template: about
___nova_flexible_content_fields: ["content"]
content: [
{
"layout":"wysiwyg",
"key":"375e6p6ga6xbiutncxep8-wysiwyg",
"attributes":{
"375e6p6ga6xbiutncxep8-wysiwyg__title":"Content title",
"375e6p6ga6xbiutncxep8-wysiwyg__content":"Content"
}
},
{
"layout":"video",
"key":"muuwrwtmtkspryr0hdpjb-video",
"attributes":{
"muuwrwtmtkspryr0hdpjb-video__title":"Video title",
"muuwrwtmtkspryr0hdpjb-video__video":"",
"muuwrwtmtkspryr0hdpjb-video__caption":""
}
}
]
viaResource:
viaResourceId:
viaRelationship:
@Nyratas the problem is the field name
flexible only get the first content within NDC cause the name is same so the layout on the 2nd layout will not be register on flexible
public function addLayout(...$arguments)
{
$count = count($arguments);
if ($count === 2) {
$this->registerLayout(new Layout($arguments[0], 'default', $arguments[1]));
return $this;
}
...
}
public function fields(Request $request)
{
return [
ID::make()
->hideFromIndex()
->hideFromDetail(),
Text::make('Title'),
Select::make('Template')
->options(['about' => 'About', 'default' => 'Default'])
->displayUsingLabels(),
NovaDependencyContainer::make([
Flexible::make('Content')
// ->addLayout('Simple content section', 'wysiwyg', [
// Text::make('Title'),
// Markdown::make('Content')
// ])
->addLayout('Video section', [
Text::make('Title'),
Image::make('Video Thumbnail', 'thumbnail'),
Text::make('Video ID (YouTube)', 'video'),
Text::make('Video Caption', 'caption')
])
])->dependsOn('template', 'default'),
NovaDependencyContainer::make([
Flexible::make('Content')
->addLayout('Simple content section', [
Text::make('Title'),
Markdown::make('Content')
])
->addLayout('Video section', [
Text::make('Title'),
Image::make('Video Thumbnail', 'thumbnail'),
Text::make('Video ID (YouTube)', 'video'),
Text::make('Video Caption', 'caption')
])
])->dependsOn('template', 'about')
];
}
adding this and remove the layout when adding layout will fix this issue.
Hi, any update on this issue?
Any updates here? any solution or an enhancement would be much appreciated.
heads up I switched to DigitalCreative\ConditionalContainer\ConditionalContainer
and it solved all my issues
Hi!
I try to use NovaDependencyContainer package with NovaFlexibleContent package. I do this in a resource:
If I add only a video section, it works with both template default and about. But when I add a wysiwyg in about template, I have this error :
Call to a member function name() on null
at\whitecube\Nova-flexible-content\src\Value\Resolver.php:20
Thank you for your help!