Skip to content

Commit 2b25a5c

Browse files
committed
Add option to {en,dis}able widget display
1 parent 94b95e1 commit 2b25a5c

File tree

13 files changed

+65
-4
lines changed

13 files changed

+65
-4
lines changed

Admin/Controller/Tile.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ class Tile extends \XF\Admin\Controller\AbstractController
88
{
99
public function actionIndex()
1010
{
11+
$options = $this->em()->findByIds('XF:Option', ['ifGsEnable']);
1112
$repo = $this->getTileRepo();
1213
$viewParams = [
13-
'tiles' => $repo->getTiles()->fetch()
14+
'tiles' => $repo->getTiles()->fetch(),
15+
'options' => $options
1416
];
1517
return $this->view('Inforge\GridShow:TileList', 'if_gs_tile_list', $viewParams);
1618
}

Setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function installStep2()
3333
{
3434
$this->createWidget('if_gs_home_gridshow', 'if_gs_widget', [
3535
'positions' => [ 'forum_list_above_nodes' => 5 ],
36-
'display_condition' => '$xf.visitor->hasPermission("ifgs", "view")'
36+
'display_condition' => '$xf.options.ifGsEnable AND $xf.visitor->hasPermission("ifgs", "view")'
3737
], '[Inforge] GridShow Widget');
3838
}
3939

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ifGridShow.json": {
3+
"hash": "55a128e9412fd3df3788e11ba7167339"
4+
}
5+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"icon": "fas fa-plus-square",
3+
"display_order": 3200,
4+
"advanced": false,
5+
"debug_only": false
6+
}

_output/options/_metadata.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ifGsEnable.json": {
3+
"hash": "f1bb7d3770293f80a6e7b7d8d40ee73b"
4+
}
5+
}

_output/options/ifGsEnable.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"edit_format": "onoff",
3+
"edit_format_params": "",
4+
"data_type": "boolean",
5+
"sub_options": [],
6+
"validation_class": "",
7+
"validation_method": "",
8+
"advanced": false,
9+
"default_value": "1",
10+
"relations": {
11+
"ifGridShow": 5
12+
}
13+
}

_output/phrases/_metadata.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,30 @@
4141
"version_string": "1.0.0",
4242
"hash": "491be8ac06c38c3531c162cb203c78b9"
4343
},
44+
"option.ifGsEnable.txt": {
45+
"global_cache": false,
46+
"version_id": 1000070,
47+
"version_string": "1.0.0",
48+
"hash": "5b497c387f76e008cb46bfbe6545dbb9"
49+
},
50+
"option_explain.ifGsEnable.txt": {
51+
"global_cache": false,
52+
"version_id": 1000070,
53+
"version_string": "1.0.0",
54+
"hash": "848f2f516e91fc98f38b61454649f53e"
55+
},
56+
"option_group.ifGridShow.txt": {
57+
"global_cache": false,
58+
"version_id": 1000070,
59+
"version_string": "1.0.0",
60+
"hash": "cd5dea941073f5f7cee1d6b1917837eb"
61+
},
62+
"option_group_description.ifGridShow.txt": {
63+
"global_cache": false,
64+
"version_id": 1000070,
65+
"version_string": "1.0.0",
66+
"hash": "350283433d9f54cfd6bf0d076ec39247"
67+
},
4468
"permission.ifgs_view.txt": {
4569
"global_cache": false,
4670
"version_id": 1000070,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Enable GridShow
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
If enabled, the GridShow widget will be displayed in the forum homepage to those users that have the permission to view it. If disable, the GridShow widget will be hidden.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[Inforge] GridShow

0 commit comments

Comments
 (0)