File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,15 @@ public function actions()
8686 'baseTemplateParams' => [
8787 'homeUrl' => Yii::$app->homeUrl,
8888 'siteName' => Yii::$app->name
89+ ],
90+ // some comment widget params
91+ 'commentWidgetParams' => [
92+ 'maxLevel' => 1,
93+ 'dataProviderConfig' => [
94+ 'pagination' => [
95+ 'pageSize' => 5
96+ ],
97+ ],
8998 ]
9099 ]
91100 ];
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ class PageAction extends Action
3535 */
3636 public $ baseTemplateParams = [];
3737
38+ /**
39+ * @var array
40+ */
41+ public $ commentWidgetParams = [];
42+
3843 /**
3944 * Initializes the object.
4045 */
@@ -65,6 +70,7 @@ public function run()
6570
6671 return $ this ->controller ->render ($ this ->view , [
6772 'model ' => $ model ,
73+ 'commentWidgetParams ' => $ this ->commentWidgetParams ,
6874 ]);
6975 }
7076
Original file line number Diff line number Diff line change 22
33/* @var $this \yii\web\View */
44/* @var $model \yii2mod\cms\models\CmsModel */
5+ /* @var $commentWidgetParams array */
56
7+ use yii \helpers \ArrayHelper ;
68use yii2mod \comments \widgets \Comment ;
79
810$ this ->params ['bodyClass ' ] = $ model ->url ;
1416 <h1><?php echo $ model ->title ; ?> </h1>
1517 <?php echo $ model ->getContent (); ?>
1618 <?php if ($ model ->commentAvailable ): ?>
17- <?php echo Comment::widget ([
18- 'model ' => $ model ,
19- 'relatedTo ' => 'cms page: ' . $ model ->url ,
20- ]); ?>
19+ <?php echo Comment::widget (ArrayHelper::merge (
20+ [
21+ 'model ' => $ model ,
22+ 'relatedTo ' => 'cms page: ' . $ model ->url ,
23+ ],
24+ $ commentWidgetParams
25+ )); ?>
26+
2127 <?php endif ; ?>
2228</div>
You can’t perform that action at this time.
0 commit comments