コード例 #1
0
ファイル: _form.php プロジェクト: tolik505/bl
<div class="menu-form">
    <?php 
echo Html::errorSummary($values, ['class' => 'alert alert-danger']);
?>
    <?php 
/** @var \metalguardian\formBuilder\ActiveFormBuilder $form */
$form = \metalguardian\formBuilder\ActiveFormBuilder::begin();
?>

    <?php 
$items = [];
$content = null;
foreach ($values as $value) {
    $attribute = '[' . $value->id . ']value';
    $configuration = $value->getValueFieldConfig();
    $configuration['label'] = $value->description . ' [key: ' . $value->id . '] [language: ' . LanguageHelper::getCurrent()->code . ']';
    $content .= $form->renderField($value, $attribute, $configuration);
    if ($value instanceof \common\components\model\Translateable && $value->isTranslateAttribute($attribute)) {
        foreach ($value->getTranslationModels() as $languageModel) {
            $configuration['label'] = $value->description . ' [key: ' . $value->id . '] [language: ' . $languageModel->language . ']';
            $content .= $form->renderField($languageModel, '[' . $languageModel->language . ']' . $attribute, $configuration);
        }
    }
}
echo $content;
?>

    <div class="form-group">
        <?php 
echo Html::submitButton(Yii::t('app', 'Save'), ['class' => 'btn btn-success']);
?>
コード例 #2
0
ファイル: _subscribe_form.php プロジェクト: tolik505/bl
    <h4><?php 
echo Yii::t('app', 'Get in touch');
?>
<span class="head-line"></span></h4>
    <p><?php 
echo Yii::t('app', 'Join our mailing list to stay up to date and get notices about our new releases!');
?>
</p>
    <?php 
$form = ActiveForm::begin(['id' => 'subscribe', 'action' => MailRequest::getSubscribeUrl(), 'options' => ['class' => 'subscribe ajax-form'], 'fieldConfig' => ['template' => '{input}']]);
?>
    <?php 
echo $form->field($model, 'label')->textInput(['placeholder' => '*****@*****.**']);
?>
    <?php 
echo $form->field($model, 'language')->hiddenInput(['value' => LanguageHelper::getCurrent()->code]);
?>

    <input type="submit" class="main-button" value="<?php 
echo isset($success) ? Yii::t('app', 'Done') : Yii::t('app', 'Send');
?>
">
    <?php 
echo $form->errorSummary($model);
?>

    <?php 
ActiveForm::end();
?>
</div>