本文整理汇总了PHP中vova07\imperavi\Widget类的典型用法代码示例。如果您正苦于以下问题:PHP Widget类的具体用法?PHP Widget怎么用?PHP Widget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Widget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$settings = ArrayHelper::merge($this->getDefaultSettings(), $this->settings);
$content = '';
foreach (Yii::$app->lang->getLanguages() as $langKey => $langTitle) {
$htmlOptions = ['class' => ''];
$htmlOptions['data-ml-language'] = $langTitle;
if ($langKey != Yii::$app->lang->get()) {
$htmlOptions['class'] .= ' hidden';
$attributeName = $this->attribute . '_' . $langKey;
} else {
$attributeName = $this->attribute;
}
$content .= Html::tag('div', Widget::widget(['model' => $this->model, 'attribute' => $attributeName, 'settings' => $settings, 'plugins' => $this->plugins]), $htmlOptions);
}
$groupName = str_replace('\\', '', get_class($this->model) . '_' . $this->attribute . '_' . 'multilang');
$content = Html::tag('div', $content, ['data-ml-group' => $groupName, 'class' => 'ml-group-wrapper']);
Yii::$app->view->registerJs('$.fn.m22Multilang.register(\'[data-ml-group="' . $groupName . '"]\')', View::POS_READY);
foreach ($this->css as $style => $options) {
Yii::$app->view->registerCssFile($style, $options);
}
return $content;
}
示例2: compact
* @var yii\web\View $this
* @var bariew\templateAbstractModule\models\Config $model
* @var yii\widgets\ActiveForm $form
*/
?>
<div class="config-form">
<?php
$form = ActiveForm::begin();
?>
<?php
$tabs = [['label' => Yii::t('app', 'Main'), 'content' => $this->render('_formMain', compact('form', 'model'))]];
foreach ($model->languageList() as $language) {
$tabs[] = ['label' => $language, 'active' => empty($active) && ($active = $model->hasErrors('content') || ($active = $model->hasErrors('subject'))), 'content' => $form->field($model, "subject[{$language}]", ['options' => ['class' => 'subjectInput']])->textInput() . $form->field($model, "content[{$language}]", ['options' => ['class' => 'messageInput']])->widget(\vova07\imperavi\Widget::className(), ['options' => ['style' => ['min-height' => '200px']], 'settings' => ['deniedTags' => [], 'convertDivs' => false, 'paragraphy' => false, 'formattingTags' => [], 'convertLinks' => false, 'cleanup' => false, 'removeEmptyTags' => false, 'cleanSpaces' => false, 'cleanFontTag' => false, 'tidyHtml' => false, 'paragraphize' => false, 'replaceDivs' => false, 'replaceTags' => false, 'replaceStyles' => false, 'removeEmpty' => false, 'minHeight' => 200]])];
}
?>
<?php
echo \yii\bootstrap\Tabs::widget(['items' => $tabs]);
?>
<label><?php
echo Yii::t('modules/template', 'Variables');
?>
</label>
<div class="configVariables">
<?php
echo DetailView::widget(['model' => false, 'attributes' => $model->variables()]);
?>
</div>
示例3:
<?php
/**
* @var $attribute_name string
* @var $form \yii\widgets\ActiveForm
* @var $label string
* @var $model \app\properties\AbstractModel
* @var $multiple boolean
* @var $property_id integer
* @var $property_key string
* @var $this \app\properties\handlers\Handler
* @var $values array
*/
use vova07\imperavi\Widget as ImperaviWidget;
use yii\helpers\Url;
echo $form->field($model, $property_key . '[0]')->widget(ImperaviWidget::className(), ['settings' => ['replaceDivs' => false, 'minHeight' => 200, 'paragraphize' => true, 'pastePlainText' => true, 'buttonSource' => true, 'imageManagerJson' => Url::to(['/backend/dashboard/imperavi-images-get']), 'plugins' => ['table', 'fontsize', 'fontfamily', 'fontcolor', 'video', 'imagemanager'], 'replaceStyles' => [], 'replaceTags' => [], 'deniedTags' => [], 'removeEmpty' => [], 'imageUpload' => Url::to(['/backend/dashboard/imperavi-image-upload'])]]);
示例4:
<?php
echo $form->field($model, 'introtext')->textarea(['rows' => 12]);
?>
<?php
}
?>
</div> <!-- end col-lg-6 -->
<div class="col-lg-6">
<?php
if ($editor == "imperavi") {
?>
<?php
echo $form->field($model, 'fulltext')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['minHeight' => 250, 'paragraphize' => false, 'cleanOnPaste' => false, 'replaceDivs' => false, 'linebreaks' => false, 'plugins' => ['fullscreen', 'imagemanager'], 'imageUpload' => Url::to(['/articles/items/image-upload']), 'imageManagerJson' => Url::to(['/articles/items/images-get'])]]);
?>
<?php
} else {
?>
<?php
echo $form->field($model, 'fulltext')->textarea(['rows' => 12]);
?>
<?php
}
?>
</div> <!-- end col-lg-6 -->
</div> <!-- end #item -->
示例5:
<?php
echo $form->field($model, 'source_title')->widget(\yii\jui\AutoComplete::className(), ['clientOptions' => ['source' => $data, 'minLength' => '3', 'autoFill' => true], 'options' => ['class' => 'form-control']]);
?>
<?php
if (!$redactor) {
?>
<?php
echo $form->field($model, 'body')->textarea(['rows' => 5, 'cols' => 5, 'id' => 'my-textarea-id']);
?>
<?php
} else {
?>
<?php
echo $form->field($model, 'body')->widget(Widget::classname(), ['settings' => ['lang' => 'ru', 'minHeight' => 300, 'pastePlainText' => true, 'buttonSource' => true, 'plugins' => ['clips', 'fullscreen'], 'imageUpload' => Url::to(['/articles/image-upload'])]]);
?>
<?php
}
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Создать' : 'Обновить', ['class' => 'btn btn-primary', 'name' => 'create-button']);
?>
</div>
<?php
ActiveForm::end();
示例6: isset
case Content::ATTR_TYPE_TITLE:
echo $form->field($model, $attr)->textInput(isset($value['config']) ? $value['config'] : []);
$titleAttribute = $attr;
break;
case Content::ATTR_TYPE_STRING:
echo $form->field($model, $attr)->textInput(isset($value['config']) ? $value['config'] : []);
break;
case Content::ATTR_TYPE_INTEGER:
echo $form->field($model, $attr)->input('number', isset($value['config']) ? $value['config'] : []);
break;
case Content::ATTR_TYPE_URL:
echo $form->field($model, $attr, ['template' => '{label}<div class="input-group"><span class="input-group-addon attached-button-chain"><i class="icon fa fa-chain"></i></span>{input}</div> {hint}{error}'])->textInput(isset($value['config']) ? $value['config'] : []);
$urlAttribute = $attr;
break;
case Content::ATTR_TYPE_ADVANCED_TEXT:
echo $form->field($model, $attr, ['options' => ['class' => 'form-group col-sm-12']])->widget(Widget::className(), isset($value['config']) ? $value['config'] : []);
break;
case Content::ATTR_TYPE_IMAGE:
echo $form->field($model, $attr)->widget(FileAPI::className(), isset($value['config']) ? $value['config'] : []);
break;
case Content::ATTR_TYPE_TEXT:
echo $form->field($model, $attr)->textarea(isset($value['config']) ? $value['config'] : []);
break;
case Content::ATTR_TYPE_DATE:
echo $form->field($model, $attr)->widget(DateTimePicker::classname(), isset($value['config']) ? $value['config'] : []);
break;
case Content::ATTR_TYPE_BOOLEAN:
echo $form->field($model, $attr)->checkbox();
break;
case Content::ATTR_TYPE_DROPDOWN:
echo $form->field($model, $attr)->dropDownList(isset($value['items']) ? $value['items'] : [], isset($value['config']) ? $value['config'] : []);
示例7: init
/**
* @inheritdoc
*/
public function init()
{
if ($this->url === null) {
throw new InvalidConfigException('The "url" attribute must be set.');
} else {
$this->url = rtrim($this->url, '/') . '/';
}
if ($this->path === null) {
throw new InvalidConfigException('The "path" attribute must be set.');
} else {
$this->path = rtrim(Yii::getAlias($this->path), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
if (!FileHelper::createDirectory($this->path)) {
throw new InvalidCallException("Directory specified in 'path' attribute doesn't exist or cannot be created.");
}
}
if ($this->uploadOnlyImage !== true) {
$this->_validator = 'file';
}
Widget::registerTranslations();
}
示例8:
JS;
$this->registerJs($js);
?>
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'slug')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'announcement')->textarea(['rows' => 6]);
echo $form->field($model, 'content')->widget(Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'imageUpload' => Url::to(['page/image-upload']), 'plugins' => ['fullscreen', 'fontcolor', 'table', 'clips']]]);
?>
<?php
echo $form->field($model, 'is_available')->checkbox();
?>
<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();
示例9:
<?php
/** @var \yii\web\View $this */
/** @var integer $language_id */
/** @var \DevGroup\Multilingual\models\Language $language */
/** @var \app\models\PageTranslation $model */
/** @var string $attributePrefix */
/** @var \yii\widgets\ActiveForm $form */
use yii\helpers\Url;
echo $form->field($model, $attributePrefix . 'title');
echo $form->field($model, $attributePrefix . 'is_published')->widget(kartik\widgets\SwitchInput::className());
echo $form->field($model, $attributePrefix . 'content')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['minHeight' => 200, 'plugins' => ['table', 'fontsize', 'fontfamily', 'fontcolor', 'video', 'imagemanager', 'clips', 'fullscreen', 'filemanager'], 'pastePlainText' => true, 'buttonSource' => true, 'replaceStyles' => [], 'replaceTags' => [], 'deniedTags' => [], 'removeEmpty' => [], 'imageUpload' => Url::to(['/admin/image-upload']), 'imageManagerJson' => Url::to(['/admin/images-get']), 'fileUpload' => Url::to(['/admin/file-upload']), 'fileManagerJson' => Url::to(['/admin/files-get'])]]);
?>
<!-- ok -->
示例10: substr
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => 65, 'placeholder' => Yii::t('app', 'Title contain a seo keyword if possible')]);
?>
</div>
</div>
<?php
echo $form->field($model, 'description')->textArea(['maxlength' => 155, 'placeholder' => Yii::t('app', 'This description also used as meta description')]);
?>
<?php
$isettings = ['lang' => substr(Yii::$app->language, 0, 2), 'minHeight' => 400, 'toolbarFixedTopOffset' => 50, 'buttonSource' => true, 'plugins' => ['imagemanager', 'filemanager', 'video', 'table', 'clips', 'fullscreen'], 'buttons' => ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'file', 'link', 'alignment', 'horizontalrule'], 'replaceDivs' => false, 'deniedTags' => ['script']];
if ($module->enableUpload) {
$isettings = array_merge($isettings, ['imageUpload' => Url::to(['//blog/default/image-upload']), 'fileUpload' => Url::to(['//blog/default/file-upload']), 'imageManagerJson' => Url::to(['//blog/default/images-get']), 'fileManagerJson' => Url::to(['//blog/default/files-get'])]);
}
use vova07\imperavi\Widget;
echo $form->field($model, 'content')->widget(Widget::className(), ['settings' => $isettings, 'options' => ["style" => "width:100%"]]);
?>
<?php
if ($module->enableScriptsPage) {
?>
<?php
echo $form->field($model, 'scripts')->textArea(['rows' => 6, 'placeholder' => Yii::t('app', 'JavaScripts')]);
?>
<?php
}
?>
</div>
<div class="col-md-3">
<div class="well">
示例11:
// 'url' => $url,
// 'dataType' => 'json',
// 'data' => new JsExpression('function(term,page) { return {search:term}; }'),
// 'results' => new JsExpression('function(data,page) { return {results:data.results}; }'),
// ],
// 'initSelection' => new JsExpression($initScript),
// ],
// ]);
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => 255]);
?>
<?php
echo $form->field($model, 'content')->widget(\vova07\imperavi\Widget::className(), ['plugins' => ['quote' => 'backend\\assets\\EditorAssetBundle', 'skip' => 'backend\\assets\\EditorAssetBundle'], 'settings' => ['lang' => 'ru', 'minHeight' => 200, 'imageUpload' => \yii\helpers\Url::to(['/site/image-upload']), 'buttons' => ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'link', 'alignment', 'quote', 'skip'], 'plugins' => ['fullscreen', 'table', 'video', 'fontcolor'], 'deniedTags' => ['style'], 'replaceDivs' => false]]);
?>
<div class="row">
<div class="col-sm-6">
<?php
$source = [];
if (!$model->isNewRecord) {
if (isset($model->source_title) && trim($model->source_title) != '') {
$source = [0 => $model->source_title];
}
}
echo $form->field($model, 'source_id')->widget(SelectizeDropDownList::classname(), ['loadUrl' => Url::to(['source/source-list']), 'items' => $source, 'options' => ['multiple' => false], 'clientOptions' => ['valueField' => 'value', 'labelField' => 'text', 'persist' => false]]);
?>
</div>
示例12:
/* @var $model common\models\TextPages */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="text-pages-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'text')->widget(Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'replaceDivs' => false, 'imageUpload' => Url::to(['/text-pages/image-upload']), 'plugins' => ['clips', 'fullscreen', 'table', 'filemanager', 'fontcolor', 'fontfamily', 'fontsize', 'limiter', 'video', 'textdirection', 'textexpander', 'imagemanager']]]);
?>
<?php
echo $form->field($model, 'url')->textInput(['maxlength' => true]);
?>
<div class="form-group">
<?php
echo Html::submitButton($model->isNewRecord ? 'Создать' : 'Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();
?>
示例13:
?>
<?php
echo $form->field($model, 'project_id')->dropdownList(\common\models\Project::find()->select(['domain', 'id'])->indexBy('id')->column(), ['prompt' => 'Domain:'])->label('Domain');
?>
<?php
echo $form->field($model, 'alias')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'content')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['replaceDivs' => false, 'lang' => 'ru', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen'], 'pastePlainText' => false, 'paragraphize' => false]]);
?>
<?php
echo $form->field($model, 'as_theme')->dropdownList([1 => 'yes', 0 => 'no']);
?>
<?php
echo $form->field($model, 'META_TITLE')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'META_DESC')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model, 'META_KEYS')->textInput(['maxlength' => true]);
示例14:
<?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>
示例15:
/* @var $model common\models\Post */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="post-form">
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => 255]);
?>
<?php
echo \vova07\imperavi\Widget::widget(['model' => $model, 'attribute' => 'content', 'settings' => ['lang' => 'ru', 'minHeight' => 200, 'imageUpload' => Url::to(['/post/image-upload']), 'imageManagerJson' => Url::to(['/post/images-get']), 'fileUpload' => Url::to(['/post/file-upload']), 'fileManagerJson' => Url::to(['/post/files-get']), 'plugins' => ['fullscreen', 'filemanager', 'imagemanager', 'video']]]);
?>
<?php
echo $form->field($model, 'category_id')->dropDownList($model->categoryList());
?>
<?php
echo $form->field($model, 'active')->checkbox();
?>
<?php
echo $form->field($model, 'featured')->checkbox();
?>
<?php