Example #1
0
/**
 * Formulaire de création
 */
use app\modules\cms\HCms;
use app\modules\cms\models\BaseTag;
use app\modules\cms\widgets\BaseTagForm;
use yii\helpers\Html;
/**
 * @var yii\web\View $this
 * @var BaseTag      $model
 */
$this->title = HCms::t('labels', 'Create a new base tag');
?>

<div class="row panel panel-default">
    <div class="panel-heading">
        <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    </div>

    <div class="panel-body">
        <?php 
echo BaseTagForm::widget(['model' => $model]);
?>
    </div>
</div>


Example #2
0
$this->registerJs("\n    \$('#webtag-base_id').change(function() {\n        var url = '/cms/base-tags/get-form/' + \$(this).val();\n        \$('#base-model-display').load(url);\n    });\n");
?>

<div class="backend-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'base_id')->dropDownList(ArrayHelper::map($baseTags, 'id', 'code'), ['prompt' => HLib::t('messages', 'Select a value in the list')]);
?>

    <fieldset id="base-model-display">
        <?php 
echo BaseTagForm::widget(['model' => $baseModel, 'asNestedForm' => true]);
?>
    </fieldset>

    <div class="row">
        <div class="col-sm-6">
            <?php 
echo $form->field($model, 'language_id')->dropDownList(ArrayHelper::map($languages, 'id', 'iso_639_code'), ['prompt' => HLib::t('messages', 'Select a value in the list')]);
?>
        </div>

        <div class="col-sm-6">
            <?php 
echo $form->field($model, 'label')->textInput(['maxlength' => true]);
?>
        </div>
 /**
  * Renvoie le code HTML du formulaire associée à la BasePage d'identifiant $id
  *
  * @param int $id
  * @return mixed
  */
 public function actionGetForm($id)
 {
     $model = $this->findModel($id);
     return BaseTagForm::widget(['model' => $model, 'asNestedForm' => true]);
 }