本文整理匯總了PHP中yii\bootstrap\Html::passwordInput方法的典型用法代碼示例。如果您正苦於以下問題:PHP Html::passwordInput方法的具體用法?PHP Html::passwordInput怎麽用?PHP Html::passwordInput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類yii\bootstrap\Html
的用法示例。
在下文中一共展示了Html::passwordInput方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
/**
* @inheritdoc
*/
public function run()
{
parent::init();
PassfieldAsset::register($this->view);
Yii::$app->get('i18n')->translations['passfield*'] = ['class' => PhpMessageSource::className(), 'basePath' => __DIR__ . '/messages'];
if (ArrayHelper::getValue($this->pluginOptions, 'titleShow') === null) {
$this->pluginOptions['titleShow'] = Yii::t('passfield', 'Show password');
}
if (ArrayHelper::getValue($this->pluginOptions, 'titleHide') === null) {
$this->pluginOptions['titleHide'] = Yii::t('passfield', 'Hide password');
}
$pluginOptions = Json::encode($this->pluginOptions);
$this->view->registerJs(sprintf('$("#%s").passfield(%s)', $this->options['id'], $pluginOptions));
if ($this->hasModel()) {
if ($this->form == null) {
throw new InvalidConfigException(__CLASS__ . '.form property must be specified');
}
return $this->form->field($this->model, $this->attribute, ['template' => $this->template])->passwordInput($this->options)->hint($this->hint);
} else {
return Html::passwordInput($this->name, $this->value, $this->options);
}
}
示例2:
?>
<div style="margin-top: 50px;">
<?php
echo !empty($passwordInfo) ? Html::tag('div', $passwordInfo, ['class' => 'alert alert-success']) : '';
?>
<h4><?php
echo Yii::t('app', 'Change Your Password');
?>
</h4>
<?php
echo !empty($passwordError) ? Html::tag('div', $passwordError, ['class' => 'alert alert-danger']) : '';
?>
<div class="row">
<div class="col-xs-6">
<?php
echo Html::passwordInput('password', '', ['class' => 'form-control', 'placeholder' => Yii::t('app', 'Enter new password')]);
?>
</div>
<div class="col-xs-6">
<?php
echo Html::submitButton(Yii::t('app', 'Update Password'), ['class' => 'btn btn-primary']);
?>
</div>
</div>
</div>
<?php
ActiveForm::end();
?>
</div>
</div>