本文整理汇总了PHP中kartik\helpers\Html::hiddenInput方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::hiddenInput方法的具体用法?PHP Html::hiddenInput怎么用?PHP Html::hiddenInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\helpers\Html
的用法示例。
在下文中一共展示了Html::hiddenInput方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$m = $this->_module;
if ($this->model->scenario !== Module::SCN_EXPIRY) {
if ($this->model->scenario !== Module::SCN_REGISTER) {
$this->mergeAttributes(['username' => ['type' => Form::INPUT_TEXT], 'password' => ['type' => Form::INPUT_PASSWORD], 'rememberMe' => ['type' => Form::INPUT_CHECKBOX]]);
}
$this->leftFooter = $m->button(Module::BTN_FORGOT_PASSWORD) . $m->button(Module::BTN_NEW_USER);
$this->rightFooter = $m->button(Module::BTN_LOGIN);
if ($this->hasSocialAuth && $m->socialSettings['widgetEnabled']) {
$social = $m->getSocialWidget();
if (!isset($this->template)) {
$this->template = <<<HTML
<div class="row">
<div class="col-sm-8">
<legend>{$this->title}</legend>
{fields}
</div>
<div class="col-sm-4">
<legend>{$this->authTitle}</legend>
{$social}
</div>
</div>
{footer}
HTML;
} else {
$this->template = str_replace('{social}', $social, $this->template);
}
}
} else {
$password = ['type' => Form::INPUT_PASSWORD];
if (in_array(Module::SCN_EXPIRY, $m->passwordSettings['strengthMeter'])) {
$password = ['type' => Form::INPUT_WIDGET, 'widgetClass' => PasswordInput::classname(), 'options' => ['options' => ['placeholder' => Yii::t('user', 'Password'), 'autocomplete' => 'new-password']]];
}
$this->mergeAttributes(['username' => ['type' => Form::INPUT_HIDDEN], 'password' => ['type' => Form::INPUT_PASSWORD], 'password_new' => $password, 'password_confirm' => ['type' => Form::INPUT_PASSWORD]]);
$this->leftFooter = Html::hiddenInput('unlock-account', '1', ['id' => 'unlock-account']);
$this->rightFooter = $m->button(Module::BTN_SUBMIT_FORM);
}
}
示例2:
</div>
<?php
\yii\widgets\ActiveForm::end();
?>
<!--回复-->
<?php
$form = \yii\widgets\ActiveForm::begin(['action' => \yii\helpers\Url::toRoute('comment/create'), 'options' => ['class' => 'reply-form hidden']]);
?>
<?php
echo Html::hiddenInput(Html::getInputName($commentModel, 'article_id'), $model->category_id);
?>
<?php
echo Html::hiddenInput(Html::getInputName($commentModel, 'comment_type'), 'gallery');
?>
<?php
echo Html::hiddenInput(Html::getInputName($commentModel, 'parent_id'), 0, ['class' => 'parent_id']);
?>
<?php
echo $form->field($commentModel, 'content')->label(false)->textarea();
?>
<div class="form-group">
<?php
if (!Yii::$app->user->isGuest) {
?>
<button type="submit" class="btn btn-sm btn-primary">回复</button>
<?php
} else {
?>
<?php
echo Html::a('登录', ['/site/login'], ['class' => 'btn btn-primary']);
?>
示例3: renderRawInput
/**
* Renders raw form input based on the attribute settings
*
* @param string $attribute the name of the attribute
* @param string $id the input identifier
* @param array $settings the attribute settings
*
* @return string the form input markup
* @throws \yii\base\InvalidConfigException
*/
protected static function renderRawInput($attribute, &$id, $settings = [])
{
$type = ArrayHelper::getValue($settings, 'type', self::INPUT_TEXT);
$i = strpos($attribute, ']');
$attribName = $i > 0 ? substr($attribute, $i + 1) : $attribute;
if (!in_array($type, static::$_validInputs)) {
throw new InvalidConfigException("Invalid input type '{$type}' configured for the attribute '{$attribName}'.'");
}
$value = ArrayHelper::getValue($settings, 'value', null);
$options = ArrayHelper::getValue($settings, 'options', []);
$id = str_replace(['[]', '][', '[', ']', ' '], ['', '-', '-', '', '-'], $attribute);
$id = strtolower($id);
if ($type === self::INPUT_WIDGET) {
$id = empty($options['options']['id']) ? $id : $options['options']['id'];
$options['options']['id'] = $id;
} else {
$id = empty($options['id']) ? $id : $options['id'];
$options['id'] = $id;
}
if ($type === self::INPUT_STATIC || $type === self::INPUT_HIDDEN_STATIC) {
$opts = $options;
if ($type === self::INPUT_HIDDEN_STATIC) {
$opts = ArrayHelper::getValue($settings, 'hiddenStaticOptions', []);
}
Html::addCssClass($opts, 'form-control-static');
$out = Html::tag('p', $value, $opts);
if ($type === self::INPUT_HIDDEN_STATIC) {
return $out . Html::hiddenInput($attribute, $value, $opts);
}
return $out;
}
if (!isset($options['class']) && $type !== self::INPUT_CHECKBOX_BUTTON_GROUP && $type !== self::INPUT_RADIO_BUTTON_GROUP) {
$options['class'] = 'form-control';
}
if (isset(static::$_basicInputs[$type])) {
return Html::$type($attribute, $value, $options);
}
if (isset(static::$_dropdownInputs[$type])) {
if (!isset($settings['items'])) {
throw new InvalidConfigException("You must setup the 'items' array for attribute '{$attribName}' since it is a '{$type}'.");
}
$items = ArrayHelper::getValue($settings, 'items', []);
return Html::$type($attribute, $value, $items, $options);
}
if ($type === self::INPUT_CHECKBOX || $type === self::INPUT_RADIO) {
$enclosedByLabel = ArrayHelper::getValue($settings, 'enclosedByLabel', true);
$checked = !empty($value) && $value !== false ? true : false;
$out = Html::$type($attribute, $checked, $options);
return $enclosedByLabel ? "<div class='{$type}'>{$out}</div>" : $out;
}
if ($type === self::INPUT_HTML5) {
$html5type = ArrayHelper::getValue($settings, 'html5type', 'text');
return Html::input($html5type, $attribute, $value, $options);
}
if ($type === self::INPUT_WIDGET) {
$widgetClass = ArrayHelper::getValue($settings, 'widgetClass', []);
if (empty($widgetClass) && !$widgetClass instanceof InputWidget) {
throw new InvalidConfigException("A valid 'widgetClass' for '{$attribute}' must be setup and extend from 'yii\\widgets\\InputWidget'.");
}
$options['name'] = $attribute;
$options['value'] = $value;
return $widgetClass::widget($options);
}
if ($type === self::INPUT_RAW) {
return ArrayHelper::getValue($settings, 'value', '');
}
return null;
}
示例4: foreach
<?php
/**
* @var string[] $formData
* @var \app\modules\shop\models\Order $order
* @var \app\modules\shop\models\OrderTransaction $transaction
*/
?>
<form action="https://secure.futubank.com/pay" method="post" xmlns="http://www.w3.org/1999/html">
<?php
foreach ($formData as $key => $value) {
?>
<?php
echo \kartik\helpers\Html::hiddenInput($key, $value);
?>
<?php
}
?>
<input type="submit" value="<?php
echo Yii::t('app', 'Pay');
?>
" class="btn btn-primary" />
</form>