本文整理汇总了PHP中kartik\widgets\FileInput::className方法的典型用法代码示例。如果您正苦于以下问题:PHP FileInput::className方法的具体用法?PHP FileInput::className怎么用?PHP FileInput::className使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\widgets\FileInput
的用法示例。
在下文中一共展示了FileInput::className方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<div class="">
<?php
$this->beginBlock('main');
?>
<p>
<input type="tel" hidden /> <!-- disable chrome autofill -->
<?php
echo $form->field($model, 'password')->passwordInput(['maxlength' => true, 'autocomplete' => "off"]);
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'photo_url')->widget(\kartik\widgets\FileInput::className(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['allowedFileExtensions' => ['jpg', 'png', 'jpeg', 'gif', 'bmp'], 'maxFileSize' => 250]]);
?>
<?php
if ($model->photo_url != null) {
?>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-3">
<?php
echo Html::img(["uploads/" . $model->photo_url], ["width" => "150px"]);
?>
</div>
</div>
<?php
}
?>
</p>
示例2:
echo $form->field($model, 'notifications')->checkbox();
?>
<div class = 'form-group field-old_avatar'>
<div class = "row">
<div class="col-xs-12">
<label class="control-label" for="old_avatar">Ваш аватар</label>
</div>
</div>
<?php
echo Html::img($model->fileUrl, ['id' => 'old_avatar', 'width' => 100]);
?>
</div>
<?php
echo $form->field($model, 'avatar')->widget(FileInput::className(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['showRemove' => false, 'showUpload' => false]]);
?>
<h3>Смена пароля</h3>
<?php
echo $form->field($model, 'password', ['options' => ['class' => 'form-group has-feedback']])->passwordInput(['placeholder' => 'Новый пароль'])->label(false);
?>
<?php
echo $form->field($model, 'password_repeat', ['options' => ['class' => 'form-group has-feedback']])->passwordInput(['placeholder' => 'Повторите пароль'])->label(false);
?>
<div class="form-group">
<?php
echo Html::submitButton('Сохранить', ['class' => 'btn btn-primary', 'name' => 'contact-button']);
示例3:
use vova07\imperavi\Widget as Imperavi;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Slide */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="slide-form">
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
echo $form->field($model, 'image')->widget(FileInput::className(), ['options' => ['accept' => 'image/jpeg'], 'pluginOptions' => ['showUpload' => false, 'browseLabel' => Yii::t('backend/slide', 'Browse'), 'removeLabel' => Yii::t('backend/slide', 'Delete'), 'removeClass' => 'btn btn-danger', 'initialPreview' => $model->isNewRecord ? false : [Html::img(Yii::$app->urlManagerFrontEnd->baseUrl . '/uploads/slide/' . $model->id . '.jpg', ['class' => 'file-preview-image'])]]]);
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'body')->widget(Imperavi::className(), ['settings' => ['minHeight' => 200, 'plugins' => ['fontsize', 'fontfamily', 'fontcolor'], 'buttons' => ['html', 'formatting', 'bold', 'italic', 'deleted', 'link']]]);
?>
<?php
echo $form->field($model, 'sortOrder')->input('number')->hint(Yii::t('backend/slide', 'If empty it will be generated automatically'));
?>
<div class="form-group">
示例4:
<?php
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\FileInput;
use kartik\builder\TabularForm;
/**
* @var yii\web\View $this
* @var common\models\SliderImage $model
* @var yii\widgets\ActiveForm $form
*/
?>
<div class="slider-image-form">
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['publish_flag' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Опубликовано...']], 'slider' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Слайдер...']], 'href' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Ссылка...', 'maxlength' => 255]], 'body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => \vova07\imperavi\Widget::className(), 'options' => ['settings' => ['toolbarFixed' => false, 'minHeight' => 100]]], 'menu_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('menu_image') ? Html::img($model->getUploadUrl('menu_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]], 'href_enabled_flag' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Показывать кнопку перейти...']], 'created_date' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATE]], 'iframe_href' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Ссылка на iframе(если указан изображения игнорируются)...', 'maxlength' => 255]], 'banner_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('banner_image') ? Html::img($model->getUploadUrl('banner_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]], 'banner_phone_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('banner_phone_image') ? Html::img($model->getUploadUrl('banner_phone_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]], 'banner_tablet_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('banner_tablet_image') ? Html::img($model->getUploadUrl('banner_tablet_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]]]]);
echo Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'style' => 'margin-right: 20px', 'onclick' => 'window.location = "' . Url::to(['index']) . '"']);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 10px', 'name' => 'goto', 'value' => 'list']);
echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 0px']);
ActiveForm::end();
?>
</div>
示例5:
echo $form->field($model, 'ciudad')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'digito_verificacion')->textInput();
?>
<?php
echo $form->field($model, 'direccion')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'telefono')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'image')->widget(FileInput::className(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['initialPreview' => [Html::img('@web/uploads/' . $model->firma, ['class' => 'file-preview-image', 'alt' => 'The Moon', 'title' => 'The Moon'])]]]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
</div>
示例6:
<?php
echo $form->field($model, 'status')->dropDownList([Category::ENABLE => Yii::t('app', 'Enable'), Category::DISABLE => Yii::t('app', 'Disable')]);
?>
</div>
</div>
<?php
echo $form->field($model, 'description')->textarea(['rows' => 6]);
?>
<div class="row">
<div class="col-sm-6">
<?php
echo $form->field($model, 'imageFile')->widget(FileInput::className());
?>
<?php
echo $form->field($model, 'parent', ['addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-heart"></i>']]])->widget(Select2::className(), ['data' => [null => Yii::t('shop', '-- Select parent Category --')] + Category::CategoryOptions()]);
?>
</div>
</div>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('shop', 'Create') : Yii::t('shop', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
示例7:
<div class="shop-form">
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => 40]);
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => 40]);
?>
<?php
echo $form->field($model, 'imageFile')->widget(FileInput::className(), ['options' => ['multiple' => true]]);
?>
<?php
echo $form->field($model, 'description')->textarea(['rows' => 6]);
?>
<?php
echo $form->field($model, 'tags')->textInput(['maxlength' => 255]);
?>
<?php
echo $form->field($model, 'owner_id')->textInput();
?>
<div class="form-group">
示例8: array
?>
<div class="gallery-record-form">
<?php
$form = ActiveForm::begin(['id' => 'gallery-record-form', 'full' => true, 'options' => array('enctype' => 'multipart/form-data')]);
?>
<?php
echo Html::activeHiddenInput($model, 'module', ['value' => 'gallery']);
?>
<?php
echo Html::activeHiddenInput($model, 'model', ['value' => 'GalleryRecord']);
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => true, 'enableAjaxValidation' => true]);
?>
<?php
echo $form->field($model, 'file')->widget(\kartik\widgets\FileInput::className(), ['options' => ['accept' => 'image/*']]);
?>
<?php
echo Html::submitButton($model->isNewRecord ? Yii::t('gallery', 'Create') : Yii::t('gallery', 'Update'), ['class' => 'btn btn-block']);
?>
<?php
ActiveForm::end();
?>
</div>