Skip to content

Commit 3d5f18f

Browse files
committed
Add permission to show/hide widget
1 parent ae506e1 commit 3d5f18f

File tree

9 files changed

+46
-1
lines changed

9 files changed

+46
-1
lines changed

Setup.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@ public function installStep1()
3232
public function installStep2()
3333
{
3434
$this->createWidget('if_gs_home_gridshow', 'if_gs_widget', [
35-
'positions' => [ 'forum_list_above_nodes' => 5 ]
35+
'positions' => [ 'forum_list_above_nodes' => 5 ],
36+
'display_condition' => '$xf.visitor->hasPermission("ifgs", "view")'
3637
], '[Inforge] GridShow Widget');
3738
}
3839

40+
public function installStep3()
41+
{
42+
$this->applyGlobalPermission('ifgs', 'view');
43+
}
44+
3945
public function uninstallStep1()
4046
{
4147
$this->deleteWidget('if_gs_home_gridshow');

Widget/GridShow.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ public function render()
1414
return $this->renderer('if_gs_gridshow_widget', $viewParams);
1515
}
1616

17+
public function getOptionsTemplate()
18+
{
19+
return null;
20+
}
21+
1722
protected function getTileRepo()
1823
{
1924
return $this->repository('Inforge\GridShow:Tile');
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ifGsPermissions.json": {
3+
"hash": "a310a58b48345443a0dbcd592561c028"
4+
}
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"display_order": 450,
3+
"is_moderator": false
4+
}

_output/permissions/_metadata.json

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

_output/permissions/ifgs-view.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"permission_type": "flag",
3+
"interface_group_id": "ifGsPermissions",
4+
"display_order": 10,
5+
"depend_permission_id": ""
6+
}

_output/phrases/_metadata.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@
4141
"version_string": "1.0.0",
4242
"hash": "491be8ac06c38c3531c162cb203c78b9"
4343
},
44+
"permission.ifgs_view.txt": {
45+
"global_cache": false,
46+
"version_id": 1000070,
47+
"version_string": "1.0.0",
48+
"hash": "26e1736d48d8811a7132369035497797"
49+
},
50+
"permission_interface.ifGsPermissions.txt": {
51+
"global_cache": false,
52+
"version_id": 1000070,
53+
"version_string": "1.0.0",
54+
"hash": "b0a57348556c197bf302c91e7b4d9149"
55+
},
4456
"widget_def.if_gs_widget.txt": {
4557
"global_cache": false,
4658
"version_id": 1000070,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
View tiles
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[Inforge] GridShow Permissions

0 commit comments

Comments
 (0)