summaryrefslogtreecommitdiffstats
path: root/extensions/Example
diff options
context:
space:
mode:
authorGervase Markham <gerv@gerv.net>2011-01-05 17:58:05 +0100
committerGervase Markham <gerv@mozilla.org>2011-01-05 17:58:05 +0100
commit8cea190794a75022d3d95932b5895a21afb0b298 (patch)
tree15f76b5dfee647c2e5a9b55caf1cf99d377e34e1 /extensions/Example
parentf6a3f8319d442e832edc901ff12169ba17dceb81 (diff)
downloadbugzilla-8cea190794a75022d3d95932b5895a21afb0b298.tar.gz
bugzilla-8cea190794a75022d3d95932b5895a21afb0b298.tar.xz
Document how to add user settings. r,a=mkanat.
https://bugzilla.mozilla.org/show_bug.cgi?id=616427
Diffstat (limited to 'extensions/Example')
-rw-r--r--extensions/Example/Extension.pm11
-rw-r--r--extensions/Example/template/en/default/hook/global/setting-descs-settings.none.tmpl6
2 files changed, 17 insertions, 0 deletions
diff --git a/extensions/Example/Extension.pm b/extensions/Example/Extension.pm
index ab773561d..1ac121235 100644
--- a/extensions/Example/Extension.pm
+++ b/extensions/Example/Extension.pm
@@ -28,6 +28,7 @@ use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Group;
use Bugzilla::User;
+use Bugzilla::User::Setting;
use Bugzilla::Util qw(diff_arrays html_quote);
use Bugzilla::Status qw(is_open_state);
@@ -384,6 +385,16 @@ sub group_end_of_update {
sub install_before_final_checks {
my ($self, $args) = @_;
print "Install-before_final_checks hook\n" unless $args->{silent};
+
+ # Add a new user setting like this:
+ #
+ # add_setting('product_chooser', # setting name
+ # ['pretty', 'full', 'small'], # options
+ # 'pretty'); # default
+ #
+ # To add descriptions for the setting and choices, add extra values to
+ # the hash defined in global/setting-descs.none.tmpl. Do this in a hook:
+ # hook/global/setting-descs-settings.none.tmpl .
}
sub job_map {
diff --git a/extensions/Example/template/en/default/hook/global/setting-descs-settings.none.tmpl b/extensions/Example/template/en/default/hook/global/setting-descs-settings.none.tmpl
new file mode 100644
index 000000000..9dc5fc767
--- /dev/null
+++ b/extensions/Example/template/en/default/hook/global/setting-descs-settings.none.tmpl
@@ -0,0 +1,6 @@
+[%
+ setting_descs.product_chooser = "Product chooser to use when entering $terms.bugs",
+ setting_descs.pretty = "Pretty chooser with common products and icons",
+ setting_descs.full = "Full chooser with all products",
+ setting_descs.small = "Product chooser for mobile devices",
+%] \ No newline at end of file