aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-01-14 10:29:48 +0100
committerMario <mario@mariovavti.com>2019-01-14 10:29:48 +0100
commita8a5d2fc4efcc3c38bbde7b5044f5ea38a0f9e89 (patch)
tree2877d29113b1c5c047ad5197c73b1c6d7d32b798
parent90f6abfa7c31e278aab45bfaee5b79695e795b69 (diff)
parentf5e571ba40a7d3b98158af61b1ab649980bb8e27 (diff)
downloadvolse-hubzilla-a8a5d2fc4efcc3c38bbde7b5044f5ea38a0f9e89.tar.gz
volse-hubzilla-a8a5d2fc4efcc3c38bbde7b5044f5ea38a0f9e89.tar.bz2
volse-hubzilla-a8a5d2fc4efcc3c38bbde7b5044f5ea38a0f9e89.zip
Merge branch 'patch-20190113c' into 'dev'
Hooks to allow addons to add "extras" to privacy group settings edit page. See merge request hubzilla/core!1469
-rw-r--r--Zotlabs/Module/Group.php14
-rw-r--r--doc/hook/privacygroup_extras.bb12
-rw-r--r--doc/hook/privacygroup_extras_drop.bb11
-rw-r--r--doc/hook/privacygroup_extras_post.bb11
-rw-r--r--doc/hooklist.bb9
-rw-r--r--view/tpl/privacy_groups.tpl1
6 files changed, 57 insertions, 1 deletions
diff --git a/Zotlabs/Module/Group.php b/Zotlabs/Module/Group.php
index c8ccaa2cb..3dcf903ad 100644
--- a/Zotlabs/Module/Group.php
+++ b/Zotlabs/Module/Group.php
@@ -75,6 +75,10 @@ class Group extends Controller {
);
if($r)
info( t('Privacy group updated.') . EOL );
+
+ $hookinfo = [ 'pgrp_extras' => '', 'group'=>$group['id'] ];
+ call_hooks ('privacygroup_extras_post',$hookinfo);
+
build_sync_packet(local_channel(),null,true);
}
@@ -127,6 +131,10 @@ class Group extends Controller {
$i++;
}
+ $hookinfo = [ 'pgrp_extras' => '', 'group'=>argv(1) ];
+ call_hooks ('privacygroup_extras',$hookinfo);
+ $pgrp_extras = $hookinfo['pgrp_extras'];
+
$tpl = get_markup_template('privacy_groups.tpl');
$o = replace_macros($tpl, [
'$title' => t('Privacy Groups'),
@@ -136,6 +144,7 @@ class Group extends Controller {
// new group form
'$gname' => array('groupname',t('Privacy group name')),
'$public' => array('public',t('Members are visible to other channels'), false),
+ '$pgrp_extras' => $pgrp_extras,
'$form_security_token' => get_form_security_token("group_edit"),
'$submit' => t('Submit'),
@@ -166,8 +175,11 @@ class Group extends Controller {
);
if($r)
$result = group_rmv(local_channel(),$r[0]['gname']);
- if($result)
+ if($result) {
+ $hookinfo = [ 'pgrp_extras' => '', 'group'=>$argv(2) ];
+ call_hooks ('privacygroup_extras_drop',$hookinfo);
info( t('Privacy group removed.') . EOL);
+ }
else
notice( t('Unable to remove privacy group.') . EOL);
}
diff --git a/doc/hook/privacygroup_extras.bb b/doc/hook/privacygroup_extras.bb
new file mode 100644
index 000000000..bd67f2470
--- /dev/null
+++ b/doc/hook/privacygroup_extras.bb
@@ -0,0 +1,12 @@
+[h2]privacygroup_extras[/h2]
+
+Add items to the Privacy Group edit form
+
+[code]
+ $hookinfo = [ 'pgrp_extras' => '', 'group'=>$argv(1) ];
+ call_hooks ('privacygroup_extras',$hookinfo);
+ $pgrp_extras = $hookinfo['pgrp_extras'];
+[/code]
+
+see: Zotlabs/Module/Group.php
+see: view/tpl/privacy_groups.tpl
diff --git a/doc/hook/privacygroup_extras_drop.bb b/doc/hook/privacygroup_extras_drop.bb
new file mode 100644
index 000000000..fd27ab255
--- /dev/null
+++ b/doc/hook/privacygroup_extras_drop.bb
@@ -0,0 +1,11 @@
+[h2]privacygroup_extras_drop[/h2]
+
+Called after privacy group is dropped
+
+[code]
+ $hookinfo = [ 'pgrp_extras' => '', 'group'=>$argv(2) ];
+ call_hooks ('privacygroup_extras_drop',$hookinfo);
+[/code]
+
+see: Zotlabs/Module/Group.php
+see: view/tpl/privacy_groups.tpl
diff --git a/doc/hook/privacygroup_extras_post.bb b/doc/hook/privacygroup_extras_post.bb
new file mode 100644
index 000000000..704db1997
--- /dev/null
+++ b/doc/hook/privacygroup_extras_post.bb
@@ -0,0 +1,11 @@
+[h2]privacygroup_extras_post[/h2]
+
+Called as privacy group edit form is edited.
+
+[code]
+ $hookinfo = [ 'pgrp_extras' => '', 'group'=>$group['id'] ];
+ call_hooks ('privacygroup_extras_post',$hookinfo);
+[/code]
+
+see: Zotlabs/Module/Group.php
+see: view/tpl/privacy_groups.tpl
diff --git a/doc/hooklist.bb b/doc/hooklist.bb
index f7dbf3fa0..6d56d5e71 100644
--- a/doc/hooklist.bb
+++ b/doc/hooklist.bb
@@ -559,6 +559,15 @@ Hooks allow plugins/addons to "hook into" the code at many points and alter the
[zrl=[baseurl]/help/hook/prepare_body_init]prepare_body_init[/zrl]
Called before generating the HTML for a displayed conversation item
+[zrl=[baseurl]/help/hook/privacygroup_extras]privacygroup_extras[/zrl]
+ Called before generating the HTML for the Privacy Group edit options
+
+[zrl=[baseurl]/help/hook/privacygroup_extras_delete]privacygroup_extras_delete[/zrl]
+ Called after privacy group is dropped.
+
+[zrl=[baseurl]/help/hook/privacygroup_extras_post]privacygroup_extras_post[/zrl]
+ Called when privacy group edit form is submitted.
+
[zrl=[baseurl]/help/hook/proc_run]proc_run[/zrl]
Called when invoking PHP sub processes
diff --git a/view/tpl/privacy_groups.tpl b/view/tpl/privacy_groups.tpl
index b4e27ef2c..327a15aee 100644
--- a/view/tpl/privacy_groups.tpl
+++ b/view/tpl/privacy_groups.tpl
@@ -8,6 +8,7 @@
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{include file="field_input.tpl" field=$gname}}
{{include file="field_checkbox.tpl" field=$public}}
+ {{$pgrp_extras}}
<button type="submit" name="submit" class="btn btn-sm btn-primary float-right">{{$submit}}</button>
</form>
</div>