本文整理汇总了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>