Class humhub\modules\file\widgets\UploadInput

Inheritancehumhub\modules\file\widgets\UploadInput » humhub\widgets\JsWidget » humhub\components\Widget » yii\base\Widget
Subclasseshumhub\modules\file\widgets\UploadButton
Available since version1.2

The file input will upload files either to the given $url or to the default file upload route '/file/file/upload'.

The returned guids will be attached to an array input field with a default form name 'guids[]'. The default form name can either be overwritten by providing a $model and $attribute or by setting the $name field.

The resulted guids will either be appended to the surrounding form if no $form selector is given.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$attach boolean Defines if the file should be attached to the given §model right after upload, note this only works for already existing models humhub\modules\file\widgets\UploadInput
$attribute string humhub\modules\file\widgets\UploadInput
$container string Html container element. humhub\widgets\JsWidget
$content string Html content. humhub\widgets\JsWidget
$dropZone \humhub\modules\file\widgets\type humhub\modules\file\widgets\UploadInput
$events [] humhub\widgets\JsWidget
$fadeIn boolean|string|integer humhub\widgets\JsWidget
$form \humhub\modules\file\widgets\type humhub\modules\file\widgets\UploadInput
$hideInStream boolean Defines if uploaded files should set the show_in_stream flag, this has only effect if the underlying action does support the showInStream request parameter humhub\modules\file\widgets\UploadInput
$id string humhub\widgets\JsWidget
$init \humhub\modules\file\widgets\type humhub\modules\file\widgets\UploadInput
$jsWidget \humhub\modules\file\widgets\type humhub\modules\file\widgets\UploadInput
$max \humhub\modules\file\widgets\type humhub\modules\file\widgets\UploadInput
$model \yii\db\ActiveRecord humhub\modules\file\widgets\UploadInput
$multiple boolean humhub\modules\file\widgets\UploadInput
$name string humhub\modules\file\widgets\UploadInput
$options humhub\widgets\JsWidget
$postState boolean humhub\modules\file\widgets\UploadInput
$preview \humhub\modules\file\widgets\type humhub\modules\file\widgets\UploadInput
$progress \humhub\modules\file\widgets\type humhub\modules\file\widgets\UploadInput
$render boolean If set to false this widget won't be rendered humhub\components\Widget
$single boolean humhub\modules\file\widgets\UploadInput
$submitName string humhub\modules\file\widgets\UploadInput
$url \humhub\modules\file\widgets\type humhub\modules\file\widgets\UploadInput
$visible \humhub\modules\file\widgets\type humhub\modules\file\widgets\UploadInput

Public Methods

Hide inherited methods

MethodDescriptionDefined By
getAttributes() humhub\modules\file\widgets\UploadInput
getData() humhub\modules\file\widgets\UploadInput
getId() Returns the html id of this widget, if no id is set this function will generate an id if $autoGenerate is set to true (default). humhub\widgets\JsWidget
getSubmittedFiles() Returns submitted files for the given settings, either bei fetching them directly from the request in case of form-name based uploads or from the model in case of model based uploads. humhub\modules\file\widgets\UploadInput
init() humhub\modules\file\widgets\UploadInput
process() Process is a wrapper for the run method humhub\components\Widget
run() Draws the Upload Button output. humhub\modules\file\widgets\UploadInput
setDefaultOptions() Sets some default data options required by all widgets as the widget implementation and the widget evetns and initialization trigger. humhub\widgets\JsWidget
widget() Creates a widget instance and runs it. humhub\components\Widget

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getOptions() Assembles all widget attributes and data settings of this widget. humhub\widgets\JsWidget

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_CREATE humhub\libs\WidgetCreateEvent An event raised before creating a widget. humhub\components\Widget

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
DEFAULT_FORM_NAME 'fileList' humhub\modules\file\widgets\UploadInput

Property Details

$attach public property

Defines if the file should be attached to the given §model right after upload, note this only works for already existing models

public boolean $attach true
$attribute public property
public string $attribute null
$dropZone public property
public \humhub\modules\file\widgets\type $dropZone null
$form public property
public \humhub\modules\file\widgets\type $form null
$hideInStream public property

Defines if uploaded files should set the show_in_stream flag, this has only effect if the underlying action does support the showInStream request parameter

public boolean $hideInStream false
$init public property
public \humhub\modules\file\widgets\type $init true
$jsWidget public property
public \humhub\modules\file\widgets\type $jsWidget 'file.Upload'
$max public property
public \humhub\modules\file\widgets\type $max null
$model public property
public \yii\db\ActiveRecord $model null
$multiple public property
public boolean $multiple true
$name public property
public string $name 'files[]'
$postState public property (available since version 1.3.5)
public boolean $postState false
$preview public property
public \humhub\modules\file\widgets\type $preview null
$progress public property
public \humhub\modules\file\widgets\type $progress null
$single public property
public boolean $single false
$submitName public property
public string $submitName null
$url public property
public \humhub\modules\file\widgets\type $url null
$visible public property
public \humhub\modules\file\widgets\type $visible false

Method Details

getAttributes() public method

public void getAttributes ( )
getData() public method

public void getData ( )
getSubmittedFiles() public static method (available since version 1.3.5)

Returns submitted files for the given settings, either bei fetching them directly from the request in case of form-name based uploads or from the model in case of model based uploads.

public static array getSubmittedFiles ( $model, $attribute, $submitName )
$model

Model

$attribute

String

$submitName

String

init() public method

public void init ( )
run() public method

Draws the Upload Button output.

public void run ( )