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


PHP Html::getInputId方法代码示例

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


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

示例1: init

    public function init()
    {
        if (is_array($this->copyFrom)) {
            $id = Html::getInputId($this->model, $this->attribute);
            $buttonId = $id . '-copyButton';
            $this->addon['append'] = ['content' => Html::button(Icon::show('code'), ['class' => 'btn btn-primary', 'id' => $buttonId]), 'asButton' => true];
            $encodedFrom = Json::encode($this->copyFrom);
            $encodedTo = Json::encode('#' . $id);
            $js = <<<EOT
\$("#{$buttonId}").click(function(){
Admin.copyFrom(
    {$encodedFrom},
    {$encodedTo}
);
});
EOT;
            $this->form->getView()->registerJs($js);
        } elseif (is_array($this->makeSlug)) {
            $id = Html::getInputId($this->model, $this->attribute);
            $buttonId = $id . '-slugButton';
            $this->addon['append'] = ['content' => Html::button(Icon::show('code'), ['class' => 'btn btn-primary', 'id' => $buttonId]), 'asButton' => true];
            $encodedFrom = Json::encode($this->makeSlug);
            $encodedTo = Json::encode('#' . $id);
            $js = <<<EOT
\$("#{$buttonId}").click(function(){
Admin.makeSlug(
    {$encodedFrom},
    {$encodedTo}
);
});
EOT;
            $this->form->getView()->registerJs($js);
        }
        parent::init();
    }
开发者ID:heartshare,项目名称:dotplant2,代码行数:35,代码来源:ActiveField.php

示例2: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     if ($this->url === null) {
         throw new InvalidConfigException("You must setup the 'Url' property.");
     }
     if (!isset($this->options['id'])) {
         $this->options['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->getId();
     }
     parent::init();
 }
开发者ID:fourclub,项目名称:yii2-editable,代码行数:13,代码来源:Editable.php

示例3: init

 public function init()
 {
     echo Html::activeHiddenInput($this->model, $this->attribute, $this->options);
     echo Html::error($this->model, $this->attribute, $this->options);
     $id = Html::getInputId($this->model, $this->attribute);
     echo FileInput::widget(['name' => 'file', 'options' => ['accept' => 'image/*', 'multiple' => false], 'pluginEvents' => ['fileuploaded' => 'function(event, data, previewId, index) {
                 $("#' . $id . '").val(data.response.url);
             }'], 'pluginOptions' => ['initialPreview' => $this->model->{$this->attribute} ? [Html::img($this->model->{$this->attribute}, ['class' => 'file-preview-image'])] : false, 'maxFileCount' => 1, 'minFileCount' => 1, 'previewFileType' => 'image', 'multiple' => false, 'showPreview' => true, 'showUploadedThumbs' => false, 'uploadUrl' => \yii\helpers\Url::to(['/system/image/upload'])]]);
     parent::init();
 }
开发者ID:oyoy8629,项目名称:yii-core,代码行数:10,代码来源:VipFileInput.php

示例4:

 * @var $property_id integer
 * @var $property_key string
 * @var $this \app\properties\handlers\Handler
 * @var $values array
 */
?>

<?php 
// little style fix
if (!$multiple) {
    echo '<style>.field-' . \kartik\helpers\Html::getInputId($model, $property_key) . ' .select2-container .select2-choice .select2-arrow b {background: none;}</style>';
}
?>

    <div class="form-group field-<?php 
echo \kartik\helpers\Html::getInputId($model, $property_key);
?>
">
        <?php 
if ($multiple) {
    ?>
            <?php 
    echo \yii\helpers\Html::hiddenInput(\yii\helpers\Html::getInputName($model, $property_key), '');
    ?>
        <?php 
}
?>
        <?php 
echo \yii\helpers\Html::activeLabel($model, $property_key, ['class' => 'col-md-2 control-label']);
?>
        <div class="col-md-10">
开发者ID:ar7n,项目名称:dotplant2,代码行数:31,代码来源:backend-edit.php

示例5: initOptions

 /**
  * Initializes the widget options.
  */
 public function initOptions()
 {
     Html::addCssClass($this->labelOptions, 'control-label');
     Html::addCssClass($this->separatorOptions, 'kv-field-separator');
     if (isset(self::$_inputWidgets[$this->type])) {
         $this->widgetClass = $this->type;
     }
     if ($this->_isInput && empty($this->options1['class'])) {
         Html::addCssClass($this->options1, 'form-control');
     }
     if ($this->_isInput && empty($this->options2['class'])) {
         Html::addCssClass($this->options2, 'form-control');
     }
     if (empty($this->options['id'])) {
         $this->options['id'] = $this->getId();
     }
     if (empty($this->options1['id'])) {
         $this->options1['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute1) : $this->options['id'] . '-1';
     }
     if (empty($this->options2['id'])) {
         $this->options2['id'] = $this->hasModel() ? Html::getInputId($this->model, $this->attribute2) : $this->options['id'] . '-2';
     }
     if (empty($this->errorContainer['id'])) {
         $this->errorContainer['id'] = $this->options1['id'] . '-error';
     }
     $this->container['id'] = $this->options['id'] . '-container';
 }
开发者ID:kartik-v,项目名称:yii2-field-range,代码行数:30,代码来源:FieldRange.php

示例6: init

    public function init()
    {
        $fields = ['copyFrom' => ['buttonIdSuffix' => '-copyButton', 'buttonIcon' => 'code', 'jsMethodName' => 'Admin.copyFrom'], 'makeSlug' => ['buttonIdSuffix' => '-slugButton', 'buttonIcon' => 'code', 'jsMethodName' => 'Admin.makeSlug'], 'makeKey' => ['buttonIdSuffix' => '-keyButton', 'buttonIcon' => 'code', 'jsMethodName' => 'Admin.makeKey']];
        foreach ($fields as $fieldName => $params) {
            if (true === is_array($this->{$fieldName})) {
                $id = Html::getInputId($this->model, $this->attribute);
                $buttonId = $id . $params['buttonIdSuffix'];
                $this->addon['append'] = ['content' => Html::button(Icon::show($params['buttonIcon']), ['class' => 'btn btn-primary', 'id' => $buttonId]), 'asButton' => true];
                $encodedFrom = Json::encode($this->{$fieldName});
                $encodedTo = Json::encode('#' . $id);
                $js = <<<EOT
\$("#{$buttonId}").click(function() {
    {$params['jsMethodName']}({$encodedFrom}, {$encodedTo});
});
EOT;
                $this->form->getView()->registerJs($js);
            }
        }
        parent::init();
    }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:20,代码来源:ActiveField.php


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