public function actionEditPart($id = '')
 {
     $model = $this->loadModel(ThemeParts::className(), $id, true);
     if ($model->isNewRecord === true) {
         $model->loadDefaultValues();
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->save()) {
             return $this->redirectUser($model->id, true, 'index', 'edit-part');
         }
     }
     return $this->render('edit-part', ['model' => $model]);
 }
예제 #2
0
 /**
  * Relation to ThemeParts that we can apply to
  * @return \yii\db\ActiveQuery
  */
 public function getApplicableParts()
 {
     return $this->hasMany(ThemeParts::className(), ['id' => 'part_id'])->via('applying');
 }
예제 #3
0
 /**
  * Relation to ThemeParts that we can apply to
  * @return \yii\db\ActiveQuery
  */
 public function getPart()
 {
     return $this->hasOne(ThemeParts::className(), ['id' => 'part_id']);
 }
예제 #4
0
 /**
  * @param array $attributesRow
  * @return string[] Array of cache tags
  */
 public static function getCacheTags($attributesRow)
 {
     $tags = explode("\n", $attributesRow['cache_tags']);
     $tags[] = ActiveRecordHelper::getObjectTag(ThemeParts::className(), $attributesRow['id']);
     $tags[] = ActiveRecordHelper::getCommonTag(ThemeActiveWidgets::className());
     return $tags;
 }