src/FormField/Upload.php
public function renderView()
    {
        //need before parent rendering.
        if ($this->disabled) {
            $this->addClass('disabled');
        }
        parent::renderView();

        if (!$this->hasUploadCb || !$this->hasDeleteCb) {
            throw new Exception('onUpload and onDelete callback must be called to use file upload');
        }
        if (!empty($this->accept)) {
            $this->template->trySet('accept', implode(',', $this->accept));
        }
        if ($this->multiple) {
            //$this->template->trySet('multiple', 'multiple');
        }

        if ($this->placeholder) {
            $this->template->trySet('PlaceHolder', $this->placeholder);
        }

        //$value = $this->field ? $this->field->get() : $this->content;
        $this->js(true)->atkFileUpload([
            'uri'      => $this->cb->getJSURL(),
            'action'   => $this->action->name,
            'file'     => ['id' => $this->fileId ?: $this->field->get(), 'name' => $this->getInputValue()],
            'hasFocus' => $this->hasFocusEnable,
            'submit'   => ($this->form->buttonSave) ? $this->form->buttonSave->name : null,
        ]);
    }
public function renderView()
    {
        //need before parent rendering.
        if ($this->disabled) {
            $this->addClass('disabled');
        }
        parent::renderView();

        if (!$this->hasUploadCb || !$this->hasDeleteCb) {
            throw new Exception('onUpload and onDelete callback must be called to use file upload');
        }
        if (!empty($this->accept)) {
            $this->template->trySet('accept', implode(',', $this->accept));
        }
        if ($this->multiple) {
            //$this->template->trySet('multiple', 'multiple');
        }

        if ($this->placeholder) {
            $this->template->trySet('PlaceHolder', $this->placeholder);
        }

        //$value = $this->field ? $this->field->get() : $this->content;
        $this->js(true)->atkFileUpload([
            'uri'      => $this->cb->getJSURL(),
            'action'   => $this->action->name,
            'file'     => ['id' => $this->fileId ?: $this->field->get(), 'name' => $this->getInputValue()],
            'hasFocus' => $this->hasFocusEnable,
            'submit'   => ($this->form->buttonSave) ? $this->form->buttonSave->name : null,
        ]);
    }
public function renderView ( ) { //need before parent rendering. if ( $ this -> disabled ) { $ this -> addClass ( 'disabled' ) ; } parent :: renderView ( ) ; if ( ! $ this -> hasUploadCb || ! $ this -> hasDeleteCb ) { throw new Exception ( 'onUpload and onDelete callback must be called to use file upload' ) ; } if ( ! empty ( $ this -> accept ) ) { $ this -> template -> trySet ( 'accept' , implode ( ',' , $ this -> accept ) ) ; } if ( $ this -> multiple ) { //$this->template->trySet('multiple', 'multiple'); } if ( $ this -> placeholder ) { $ this -> template -> trySet ( 'PlaceHolder' , $ this -> placeholder ) ; } //$value = $this->field ? $this->field->get() : $this->content; $ this -> js ( true ) -> atkFileUpload ( [ 'uri' => $ this -> cb -> getJSURL ( ) , 'action' => $ this -> action -> name , 'file' => [ 'id' => $ this -> fileId ? : $ this -> field -> get ( ) , 'name' => $ this -> getInputValue ( ) ] , 'hasFocus' => $ this -> hasFocusEnable , 'submit' => ( $ this -> form -> buttonSave ) ? $ this -> form -> buttonSave -> name : null , ] ) ; }
Rendering view.
Rendering view .