当前位置: 首页>>代码示例>>PHP>>正文


PHP Html::activeLabel方法代码示例

本文整理汇总了PHP中yii\helpers\Html::activeLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::activeLabel方法的具体用法?PHP Html::activeLabel怎么用?PHP Html::activeLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\helpers\Html的用法示例。


在下文中一共展示了Html::activeLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $label = Html::activeLabel($this->translations[0], $this->fieldName, ['class' => 'control-label']);
     $tabs = Tabs::widget(['encodeLabels' => false, 'items' => $this->_tabItems, 'options' => ['class' => 'translation-tabs']]);
     $content = Html::tag('div', $label . $tabs, ['class' => 'form-group nav-tabs-custom language-tabs']);
     return $content;
 }
开发者ID:HeavyDots,项目名称:heavyCMS,代码行数:7,代码来源:LanguageTabs.php

示例2: run

    public function run()
    {
        echo Html::activeLabel($this->model, $this->titleAttribute);
        echo Html::activeTextInput($this->model, $this->titleAttribute, ['id' => 'title-input', 'maxlength' => 64]);
        echo '<div id="slug-block">';
        echo Html::activeLabel($this->model, $this->slugAttribute);
        echo Html::activeTextInput($this->model, $this->slugAttribute, ['id' => 'slug-input', 'value' => '', 'maxlength' => 64]);
        echo '
<div id="results"></div>
</div><!--/slug-block-->
';
        $this->registerAssets();
    }
开发者ID:rybinden,项目名称:yii2-select-slug,代码行数:13,代码来源:InputText.php

示例3: init

 public function init()
 {
     parent::init();
     $this->_inputStr = '<div class="form-group">';
     if ($this->hasModel()) {
         $this->_inputStr .= Html::activeLabel($this->model, $this->attribute);
     } else {
         $this->_inputStr .= Html::label($this->name);
     }
     $this->_inputStr .= '<div id="' . Html::encode($this->name) . '" class="input-group date">';
     if ($this->hasModel()) {
         $value = Html::getAttributeValue($this->model, $this->attribute);
     } else {
         $value = $this->value;
     }
     if ($value !== null) {
         $value = Yii::$app->formatter->asDatetime($value);
     }
     $options = $this->options;
     $options['class'] = 'form-control';
     //$options['readonly'] = '';
     $options['value'] = $value;
     if ($this->hasModel()) {
         $this->_inputStr .= Html::activeTextInput($this->model, $this->attribute, $options);
     } else {
         $this->_inputStr .= Html::textInput($this->name, $this->value, $options);
     }
     $this->_inputStr .= '<span class="input-group-addon">
                                     <span class="glyphicon-calendar glyphicon"></span>
                                 </span>
                             </div>
                             </div>
                             ';
 }
开发者ID:Penton,项目名称:MoBlog,代码行数:34,代码来源:BootstrapDatetimePicker.php

示例4: renderHtml

 /**
  * @inheritdoc
  */
 public function renderHtml()
 {
     if ($this->model !== null) {
         return Html::activeLabel($this->model, $this->attribute, $this->options);
     }
     return Html::label($this->text, null, $this->options);
 }
开发者ID:phpdn,项目名称:qc-base,代码行数:10,代码来源:LabelControl.php

示例5: render

 public function render($content = null)
 {
     if ($content === null) {
         if (!isset($this->parts['{input}'])) {
             $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions);
         }
         if (!isset($this->parts['{label}'])) {
             $labelsHelp = $this->model->attributeHints();
             if (isset($labelsHelp[$this->attribute])) {
                 $this->labelOptions['label'] = '<span data-toggle="tooltip" title="" data-original-title="';
                 $this->labelOptions['label'] .= Html::encode($labelsHelp[$this->attribute]);
                 $this->labelOptions['label'] .= '">';
                 $this->labelOptions['label'] .= Html::encode($this->model->getAttributeLabel($this->attribute));
                 $this->labelOptions['label'] .= ' <span class="glyphicon glyphicon-question-sign" style="font-size: 8pt;" aria-hidden="true"></span>';
                 $this->labelOptions['label'] .= '</span>';
             } else {
                 $this->labelOptions['label'] = Html::encode($this->model->getAttributeLabel($this->attribute));
             }
             $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions);
         }
         if (!isset($this->parts['{error}'])) {
             $this->parts['{error}'] = Html::error($this->model, $this->attribute, $this->errorOptions);
         }
         if (!isset($this->parts['{hint}'])) {
             $this->parts['{hint}'] = '';
         }
         $content = strtr($this->template, $this->parts);
     } elseif (!is_string($content)) {
         $content = call_user_func($content, $this);
     }
     return $this->begin() . "\n" . $content . "\n" . $this->end();
 }
开发者ID:andreosoft,项目名称:andreocms,代码行数:32,代码来源:ActiveField.php

示例6: renderLabel

 public function renderLabel()
 {
     if (!isset($this->labelOptions['for'])) {
         $this->labelOptions['for'] = $this->inputOptions['id'];
     }
     return $this->hasModel() ? Html::activeLabel($this->model, $this->attribute, $this->labelOptions) : Html::label($this->label, $this->labelOptions['for'], $this->labelOptions);
 }
开发者ID:fourteenmeister,项目名称:yii2-semantic-ui,代码行数:7,代码来源:Checkbox.php

示例7: init

 public function init()
 {
     parent::init();
     $this->_inputStr = '<div class="form-group">';
     $this->_inputStr .= Html::activeLabel($this->model, $this->attribute);
     $this->_inputStr .= Html::activeDropDownList($this->model, $this->attribute, \common\models\User::getUserGroup(), $this->options);
     $this->_inputStr .= '</div>';
 }
开发者ID:Penton,项目名称:MoBlog,代码行数:8,代码来源:UserGroupDropDownList.php

示例8: renderInput

 /**
  * Renders the input
  *
  * @return string
  */
 protected function renderInput()
 {
     $this->options = array_merge($this->options, ['style' => $this->inputStyle]);
     if (!$this->hideInput) {
         return Html::activeLabel($this->model, $this->attribute, ['class' => 'control-label']) . '<div class="input-group drp-container form-drp-input" style="' . $this->wrapperStyle . '">' . $this->getInput('textInput') . Html::submitButton('<span class="glyphicon glyphicon-floppy-save"></span> ' . \Yii::t('admin', 'Export'), ['class' => 'btn btn-info']) . '</div>' . '<div class="help-block ">' . Html::error($this->model, $this->attribute, ['class' => 'help-block help-block-error']) . '</div>';
     }
     $tag = ArrayHelper::remove($this->containerOptions, 'tag', 'div');
     $content = str_replace('{input}', $this->getInput('hiddenInput'), $this->containerTemplate);
     $content = str_replace('{error}', '<div class="help-block ">' . Html::error($this->model, $this->attribute, ['class' => 'help-block help-block-error']) . '</div>', $content);
     return Html::tag($tag, $content, $this->containerOptions);
 }
开发者ID:mistim,项目名称:yii2-theme-adminlte,代码行数:16,代码来源:DateRangePicker.php

示例9: checkbox

 public function checkbox($options = [], $type = 'checkbox', $enclosedByLabel = true)
 {
     if ($type == 'checkbox') {
         $classname = '\\vx\\Semantic\\Modules\\Checkbox';
     } else {
         $classname = '\\vx\\Semantic\\Modules\\Radio';
     }
     $config = $this->getCheckboxListOptions($options);
     $checkboxOptions = $config['checkbox'];
     $options = ['options'];
     $this->parts['{label}'] = '';
     $this->parts['{input}'] = $classname::widget(['class' => $classname::className(), 'model' => $this->model, 'attribute' => $this->attribute, 'options' => $options, 'label' => Html::activeLabel($this->model, $this->attribute, $this->labelOptions), 'inputOptions' => $checkboxOptions['inputOptions'], 'labelOptions' => $checkboxOptions['labelOptions'], 'type' => $checkboxOptions['type'], 'readOnly' => $checkboxOptions['readOnly'], 'disabled' => $checkboxOptions['disabled'], 'fitted' => $checkboxOptions['fitted'], 'encodeLabel' => $checkboxOptions['encodeLabel']]);
     return $this;
 }
开发者ID:Vincent-X,项目名称:yii2-semantic-ui,代码行数:14,代码来源:ActiveField.php

示例10: run

 public function run()
 {
     $model = $this->model;
     $attribute = $this->attribute;
     $path = $model->{$attribute} ?: $this->path . "/images/noimage.gif";
     $this->_html .= '<div class="form-group field-article-author" id="container">';
     $this->_html .= Html::activeLabel($model, $attribute);
     $this->_html .= Html::activeHiddenInput($model, $attribute, ['id' => 'hidden_input', 'value' => $path]);
     $this->_html .= '<div id="pickfiles" style="height:50px;min-width:50px;max-width: 300px;overflow: hidden;"><img height="50" src="' . $path . '" /></div>';
     $this->_html .= '</div>  ';
     UploadAsset::register($this->view);
     $this->view->registerJs('$(function(){
             initCoverImageUploader("pickfiles","container","2mb","' . $this->url . '","' . Yii::$app->request->getCsrfToken() . '","' . $this->path . '");
         });');
     return $this->_html;
 }
开发者ID:specialnote,项目名称:myYii,代码行数:16,代码来源:Plupload.php

示例11: imageField

 /**
  * Generates a form field.
  * A form field is associated with a model and an attribute. It contains a label, an input and an error message
  * and use them to interact with end users to collect their inputs for the attribute.
  * @param Model $model the data model
  * @param string $attribute the attribute name or expression. See [[Html::getAttributeName()]] for the format
  * about attribute expression.
  * @param array $options the additional configurations for the field object. These are properties of [[ActiveField]]
  * or a subclass, depending on the value of [[fieldClass]].
  * @return string the created ActiveField object
  * @see fieldConfig
  */
 public function imageField($model, $attribute, $options = [])
 {
     if ($model->{$attribute}) {
         $src = '@web/' . $model->{$attribute};
     } else {
         $src = '@web/images/no_image.jpg';
     }
     $imageField = '';
     $imageField .= Html::activeLabel($model, $attribute, ['class' => 'col-sm-12 control-label']);
     $imageField .= Html::beginTag('label', ['for' => Html::getInputId($model, $attribute), ['class' => 'col-sm-8']]);
     $imageField .= Html::img($src, $options);
     $imageField .= Html::endTag('label');
     $imageField .= Html::beginTag('span', ['class' => 'image-trash glyphicon glyphicon-remove-circle']);
     $imageField .= Html::endTag('span');
     $imageField .= Html::activeFileInput($model, $attribute, ['style' => 'display:none']);
     $imageField .= Html::activeHiddenInput($model, 'removeImage', ['value' => '0']);
     return $imageField;
 }
开发者ID:sergeyusatyuk,项目名称:HOLJ,代码行数:30,代码来源:ActiveForm.php

示例12: render

 /**
  * @inheritdoc
  */
 public function render($content = null)
 {
     if ($content === null) {
         if (!isset($this->parts['{input}'])) {
             $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->inputOptions);
         }
         if (!isset($this->parts['{label}'])) {
             $this->parts['{label}'] = Html::activeLabel($this->model, $this->attribute, $this->labelOptions);
         }
         if (!isset($this->parts['{error}'])) {
             $this->parts['{error}'] = $this->_error($this->model, $this->attribute, $this->errorOptions);
         }
         if (!isset($this->parts['{hint}'])) {
             $this->parts['{hint}'] = '';
         }
         $content = strtr($this->template, $this->parts);
     } elseif (!is_string($content)) {
         $content = call_user_func($content, $this);
     }
     return $this->begin() . "\n" . $content . "\n" . $this->end();
 }
开发者ID:rmrevin,项目名称:yii2-application,代码行数:24,代码来源:ActiveField.php

示例13: renderField

 protected function renderField($fieldName)
 {
     $type = $this->checkCustomType($fieldName);
     if (!$type) {
         $type = $this->schema->columns[$fieldName]->type;
     }
     $field = $this->form->field($this->owner, $fieldName);
     switch ($type) {
         case self::TypeHidden:
             $input = $field->hiddenInput();
             break;
         case self::TypePassword:
             $input = $field->passwordInput();
             break;
         case self::TypeFile:
             $input = $field->fileInput();
             break;
         case self::TypeBoolean:
             $input = $field->checkbox();
             break;
         case self::TypeDropDown:
             $input = $field->dropDownList($this->config['dropDown'][$fieldName]);
             break;
         case self::TypeText:
             $input = $field->textarea();
             break;
         default:
             $input = $field->textInput();
     }
     if (array_key_exists($fieldName, $this->widget)) {
         $input->widget($this->widget[$fieldName]['class'], $this->widget[$fieldName]['config']);
     }
     if ($type != self::TypeHidden) {
         $label = $type == self::TypeBoolean ? '' : Html::activeLabel($this->owner, $fieldName);
         $error = implode(', ', $this->owner->getErrors($fieldName));
         return "<div class='field {$type}'>\n                    {$label}\n                    {$input->parts['{input}']}\n                    {$error}\n                    </div>";
     } else {
         return $input->parts['{input}'];
     }
 }
开发者ID:developeruz,项目名称:yii-behaviors,代码行数:40,代码来源:SimpleFormBehavior.php

示例14: init

 public function init()
 {
     parent::init();
     $this->options['encodeSpaces'] = true;
     $this->options['prompt'] = '不选择';
     $categories = CategoryTree::getInstance()->getAllCategories();
     if (!empty($categories)) {
         foreach ($categories as $v) {
             $tempArr = [];
             $tempArr[$v['mid']] = str_repeat('    ', $v['depth'] - 1) . $v['name'];
             $this->_categories += $tempArr;
             if ($this->currentOptionDisabled) {
                 $model = $this->model;
                 $this->options['options'][$model->mid] = ['disabled' => true];
             }
         }
     }
     $this->_inputStr = '<div class="form-group">';
     $this->_inputStr .= Html::activeLabel($this->model, $this->attribute);
     $this->_inputStr .= Html::activeDropDownList($this->model, $this->attribute, $this->_categories, $this->options);
     $this->_inputStr .= '</div>';
 }
开发者ID:Penton,项目名称:MoBlog,代码行数:22,代码来源:CategoryDropDownList.php

示例15: init

 public function init()
 {
     parent::init();
     $this->options['encodeSpaces'] = true;
     $this->options['prompt'] = '不选择';
     $categories = Category::getChildCategories(intval($this->parent));
     if (!empty($categories)) {
         foreach ($categories as $v) {
             $tempArr = [];
             $tempArr[$v['id']] = str_repeat('    ', $v['class'] - 1) . $v['name'];
             $this->_categories += $tempArr;
             if ($this->currentOptionDisabled) {
                 $model = $this->model;
                 $this->options['options'][$model->id] = ['disabled' => 'disabled'];
             }
         }
     }
     $this->_html = '<div class="form-group">';
     $this->_html .= Html::activeLabel($this->model, $this->attribute);
     $this->_html .= Html::activeDropDownList($this->model, $this->attribute, $this->_categories, $this->options);
     $this->_html .= '</div>';
 }
开发者ID:specialnote,项目名称:myYii,代码行数:22,代码来源:CategoryDropDownList.php


注:本文中的yii\helpers\Html::activeLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。