nova-flexible-content icon indicating copy to clipboard operation
nova-flexible-content copied to clipboard

Flexible not work with DependOn

Open engtray-cc opened this issue 1 year ago • 2 comments

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'),

engtray-cc avatar May 24 '24 03:05 engtray-cc

up

jordansitbon avatar Aug 08 '24 13:08 jordansitbon

There's a workaround suggested in this other issue

daanadriaan avatar Nov 21 '24 11:11 daanadriaan