platform icon indicating copy to clipboard operation
platform copied to clipboard

Show uploaded files in edit form

Open 0xcrypto opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. I am using Orchid crud that includes an upload field. The uploaded file is video and I am trying to render the file within HTML video player. But I couldn't see any way to do it so far.

Describe the solution you'd like Orchid should allow creating custom HTML elements easily. Something like:

return [
    Input::make('title'),
    HTML::make('video')->render(function ($model) {
        return view('partials.video', ['video' => $model]);
    }),
];

Describe alternatives you've considered I tried using Layout to embed HTML in a form (fields function in the resource file of orchid crud). but there is an error. I couldn't find any other way to accomplish this within Orchid crud.

Additional context I am using Orchid crud.

0xcrypto avatar Sep 06 '21 02:09 0xcrypto

Hi, does the existing class ViewField not solve your problem?

tabuna avatar Sep 08 '21 13:09 tabuna

Thank @tabuna that is exactly what I am looking for. I tried finding documentation for it but found nothing. So far I am able to inject the view but unable to pass any variable to it. How do I pass the model to the view for showing already added content?

ViewField::make('video')->view('partials.video'),

0xcrypto avatar Sep 09 '21 09:09 0xcrypto