fruktozets/yii2-activecollection

Yii2 Dropzone 上传器

安装: 20

依赖者: 0

建议者: 0

安全: 0

类型:yii2-extension

1.0.1 2018-09-20 10:45 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:34:27 UTC


README

这是创建和验证关联模型的集合的失败项目。它运行正确,但由于Yii框架架构不支持此类功能,代码非常难以编写。

示例

ActiveCollectionWidget::widget([
    'model' => $customer, // Model for creating a template.
    'data' => $customerModels, // Existing models for initialization. 
    'formId' => $form->id,
    'fields' => [
        [
            'attribute' => 'image_id',
            'template' => ActiveCollectionWidget::TEMPLATE_DROPZONE,
            'widgetOptions' => [
                "addRemoveLinks" => "true",
                "acceptedFiles" => "image/*",
                "dictDefaultMessage" => "Drop file here or click to upload",
                "url" => "/image/upload",
                "maxFiles" => 1,
        ],
        'fio' => ActiveCollectionWidget::TEMPLATE_TEXT,
        'zipcode' => ActiveCollectionWidget::TEMPLATE_NUMBER,
        'position' => ActiveCollectionWidget::TEMPLATE_TEXTAREA,
    ],
])