File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 55use nullref \cms \models \Page ;
66use Yii ;
77use yii \base \Action ;
8+ use yii \caching \TagDependency ;
89use yii \web \NotFoundHttpException ;
910
1011
1516class PageView extends Action
1617{
1718 public $ view = 'view ' ;
18-
19+
1920 public function run ()
2021 {
2122 if (($ route = Yii::$ app ->request ->getQueryParam ('route ' )) == null ) {
2223 throw new NotFoundHttpException (Yii::t ('cms ' , 'Page not found. ' ));
2324 }
2425 $ page = Page::getDb ()->cache (function () use ($ route ) {
2526 return Page::find ()->byRoute ($ route )->one ();
26- });
27+ }, null , new TagDependency ([ ' tags ' => ' cms.page. ' . $ route ]) );
2728
2829 if (!isset ($ page )) {
2930 throw new NotFoundHttpException (Yii::t ('cms ' , 'Page not found. ' ));
@@ -39,6 +40,8 @@ public function run()
3940 'page ' => $ page ,
4041 ]);
4142
43+ //@TODO add tag dependency by blocks
44+
4245 return $ result ;
4346 }
4447}
Original file line number Diff line number Diff line change 55use nullref \cms \models \Page ;
66use nullref \core \interfaces \IAdminController ;
77use Yii ;
8+ use yii \caching \TagDependency ;
89use yii \data \ActiveDataProvider ;
910use yii \filters \VerbFilter ;
1011use yii \web \Controller ;
@@ -101,7 +102,8 @@ public function actionUpdate($id)
101102
102103 $ default = Yii::$ app ->request ->isPost ? ['PageHasBlock ' => []] : [];
103104 if ($ model ->loadWithRelations (array_merge ($ default , Yii::$ app ->request ->post ())) && $ model ->save ()) {
104- Yii::$ app ->cache ->delete ('cms.page. ' . $ model ->route );
105+ TagDependency::invalidate (Yii::$ app ->cache , 'cms.page. ' . $ model ->route );
106+ TagDependency::invalidate (Yii::$ app ->cache , 'cms.page. ' . $ model ->oldAttributes ['route ' ]);
105107 return $ this ->redirect (['view ' , 'id ' => $ model ->id ]);
106108 } else {
107109 return $ this ->render ('update ' , [
Original file line number Diff line number Diff line change 11<?php
22
33use mihaildev \ckeditor \CKEditor ;
4+ use mihaildev \elfinder \ElFinder ;
45use nullref \cms \assets \PageFormAssets ;
56use nullref \cms \models \Page ;
67use unclead \widgets \MultipleInput ;
@@ -55,9 +56,9 @@ class="btn btn-danger btn-xs"
5556 <div class="row" data-type="<?= Page::TYPE_CONTENT ?> " style="display: none">
5657 <div class="col-md-12">
5758 <?= $ form ->field ($ model , 'content ' )->widget (CKEditor::className (), [
58- 'editorOptions ' => [
59+ 'editorOptions ' => ElFinder:: ckeditorOptions ( ' elfinder-backend ' , [
5960 'height ' => 300 ,
60- ]
61+ ]),
6162 ]) ?>
6263 </div>
6364 </div>
You can’t perform that action at this time.
0 commit comments