nova-flexible-content
nova-flexible-content copied to clipboard
Flexible not work with DependOn
Code example : Flexible::make('Promotion Action', 'actions') ->addLayout('Media', 'media', [ Select::make('Type', 'details->type') ->options([ 'image-01' => 'ImageLink', 'video' => 'VideoLink', 'facebook' => 'FacebookLink', 'youtube' => 'YoutubeLink', ]) ->rules('required'),
FileManager::make(__('Banner'), 'image_path')
->multiple()
->limit(3)
->help('Multiple upload order by EN,KM,ZH')
->hideFromIndex()
->hide()
->dependsOn('details->type', function (FileManager $field, NovaRequest $request, FormData $formData) {
$details = data_get($formData, 'details.type');
if ($details === 'image') {
$field->show();
} else {
$field->hide();
}
}),
])
->fullWidth()
->button('Add Action'),
up
There's a workaround suggested in this other issue