我想使用此扩展为ActiveRecord类FaqCategory实现i18n功能.这是我的表格:
CREATE TABLE `FaqCategory`
(
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`icon` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8
CREATE TABLE
`FaqCategoryTranslation`
(
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`catID` int(10) unsigned DEFAULT NULL,
`languageID` tinyint(2) unsigned NOT NULL,
`title` varchar(255) DEFAULT NULL,
`slug` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `catID` (`catID`) USING BTREE,
KEY `languageID` (`languageID`),
CONSTRAINT `FCT_FK1` FOREIGN KEY (`catID`) REFERENCES `FaqCategory` (`id`) ON DELETE CASCADE ON …
Run Code Online (Sandbox Code Playgroud) 我想使用yii2 ActiveForm创建表单.这是我的代码:
<?php
$form = \yii\widgets\ActiveForm::begin([
'options' => [
'class' => 'form-inline'
]
]);
?>
<div class="form-group">
<label class="sr-only" for="example">Email</label>
<?php echo $form->field($model, 'email', [
'inputOptions' => ['autofocus' => 'autofocus', 'class' => 'form-control transparent']
])->textInput(['placeholder' => "Enter Your Email"])->input('email')->label(false); ?>
</div>
<button type="submit" class="subscr-btn btn btn-primary btn-fill">Join</button>
<?php \yii\widgets\ActiveForm::end(); ?>
Run Code Online (Sandbox Code Playgroud)
生成这个HTML:
<form id="w0" class="form-inline" action="/example" method="post">
<div class="form-group">
<label class="sr-only" for="exampleInputEmail2">Email address</label>
<div class="form-group field-subscriber-email required">
<input type="email" id="subscriber-email" class="form-control transparent" name="Subscriber[email]"
autofocus="autofocus">
<div class="help-block"></div>
</div>
</div>
<button type="submit" class="subscr-btn …
Run Code Online (Sandbox Code Playgroud)