Example #1
0
\$('#mod_entity_type_add').on('click',opencentitytypemod);

MODALJS;
$this->registerJs($modalJS);
?>

<div class="entity-form">

    <?php 
$form = ActiveForm::begin(['id' => 'EntityCreateForm', 'action' => Url::to(['/entity/default/create'])]);
?>

    <div class="row">
        <div class="col-md-12">
    <?php 
echo $form->field($model, 'entity_type_id')->widget(Select2::classname(), ['data' => EntityType::pdEntityType(), 'options' => ['placeholder' => 'Entity Type...'], 'addon' => ['prepend' => ['content' => Html::icon('globe')], 'append' => ['content' => Html::button(Html::icon('plus'), ['class' => 'btn btn-default', 'id' => 'mod_entity_type_add', 'title' => 'add new entity', 'data-toggle' => 'tooltip', 'href' => Url::to(['/entity/entity-type/create'])]), 'asButton' => true]], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            <?php 
echo $form->field($model, 'prename')->textInput(['maxlength' => 100]);
?>
        </div>
        <div class="col-md-6">
            <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 140]);
?>
        </div>
 /**
  * Finds the EntityType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return EntityType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = EntityType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEntityTypes()
 {
     return $this->hasMany(EntityType::className(), ['parent_id' => 'id']);
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEntityType()
 {
     return $this->hasOne(EntityType::className(), ['id' => 'entity_type_id']);
 }