fileupload patch

lcollong

FabriKant d'applications web
Hello,

May be it has been already set ?
On Fabrik Zeta over J4/ Php 8.1, I got an error because an expected string was actually an array on FileUpload Element.
I have to add this test around line 2584 of the file : plugins/fabrik_element/fileupload/fileupload.php

Code:
       if (($params->get('fu_show_image') !== '0' && !$this->isAjax()) || !$this->isEditable())
        {
            foreach ($values as $v)
            {
                if (is_object($v))
                {
                    $v = $v->file;
                }
// apchea               
                if (is_array($v))
                {
                    $v = reset($v);
                }
// end apchea               
                $render = $this->loadElement($v);

                if (
                    ($use_wip && $this->isEditable())
                    || (
                        $v != ''
                        && (
                            $storage->exists($v, true)
                            || StringHelper::substr($v, 0, 4) == 'http')
                    )
                )
                {
                    $render->render($this, $params, $v);
                }

                if ($render->output != '')
                {
                    if ($this->isEditable())
                    {
                        // $$$ hugh - TESTING - using HTML5 to show a selected image, so if no file, still need the span, hidden, but not the actual delete button
                        if ($use_wip && empty($v))
                        {
                            $render->output = '<span class="fabrikUploadDelete fabrikHide" data-role="delete_span">' . $render->output . '</span>';
                        }
                        else
                        {
                            $render->output = '<span class="fabrikUploadDelete" data-role="delete_span">' . $this->deleteButton($v, $repeatCounter) . $render->output . '</span>';
                        }

                        /*
                        if ($use_wip)
                        {
                            $render->output .= '<video id="' . $id . '_video_preview" controls></video>';
                        }
                        */
                    }

                    $allRenders[] = $render->output;
                }
            }
        }

Did not investigate why I got an array there. But it is while displaying back the form after a failed validation on empty element.

Laurent
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top