Additional info about adding options to preexisting option groups
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 26 Feb 2004 08:13:09 +0000 (08:13 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 26 Feb 2004 08:13:09 +0000 (08:13 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6665 7612ce4b-ef26-0410-bec9-ea0150e637f0

doc/plugin.txt

index ecbfc0c7a6e4e74ad0b945819e2b5087ac35a2b4..ead037fcc0b22b08994ad3262a6724ad659ea911 100644 (file)
@@ -548,7 +548,7 @@ as above, "demo" as our plugin name:
 
 The second way to add options to one of the SquirrelMail preferences page is
 to use one of the "optpage_loadhook_<pref page>" hooks.  The sent_subfolders
 
 The second way to add options to one of the SquirrelMail preferences page is
 to use one of the "optpage_loadhook_<pref page>" hooks.  The sent_subfolders
-plugin is an excellent example of this method.  Briefly, this way of adding
+plugin has an excellent example of this method.  Briefly, this way of adding
 options consists of adding some plugin-specific information to a predefined
 data structure which SquirrelMail then uses to build the HTML input forms
 for you.  This is the preferred method of building options lists going forward.
 options consists of adding some plugin-specific information to a predefined
 data structure which SquirrelMail then uses to build the HTML input forms
 for you.  This is the preferred method of building options lists going forward.
@@ -603,7 +603,7 @@ for you.  This is the preferred method of building options lists going forward.
                            SMOPT_TYPE_INTEGER    Integer input
                            SMOPT_TYPE_FLOAT      Floating point number input
                            SMOPT_TYPE_BOOLEAN    Boolean (yes/no radio buttons)
                            SMOPT_TYPE_INTEGER    Integer input
                            SMOPT_TYPE_FLOAT      Floating point number input
                            SMOPT_TYPE_BOOLEAN    Boolean (yes/no radio buttons)
-                                                   input
+                                                 input
                            SMOPT_TYPE_HIDDEN     Hidden input (not actually
                                                  shown on preferences page)
                            SMOPT_TYPE_COMMENT    Text is shown (specified by the
                            SMOPT_TYPE_HIDDEN     Hidden input (not actually
                                                  shown on preferences page)
                            SMOPT_TYPE_COMMENT    Text is shown (specified by the
@@ -644,6 +644,32 @@ for you.  This is the preferred method of building options lists going forward.
          post_script    You may specify some script (usually Javascript) that
                         will be placed after (outside of) the INPUT tag.
 
          post_script    You may specify some script (usually Javascript) that
                         will be placed after (outside of) the INPUT tag.
 
+      Note that you do not have to create a whole new section on the options
+      page if you merely want to add a simple input item or two to an options
+      section that already exists.  For example, the Display Options page has
+      these groups:
+
+         0  -  General Display Options
+         1  -  Mailbox Display Options
+         2  -  Message Display and Composition
+
+      To add our previous input drop-down to the Mailbox Display Options,
+      we would not have to create our own group; just add it to group
+      number one:
+
+         global $optpage_data;
+         $optpage_data['vals'][1][] = array(
+            'name'    => 'plugin_demo_favorite_color',
+            'caption' => 'Please Choose Your Favorite Color',
+            'type'    => SMOPT_TYPE_STRLIST,
+            'refresh' => SMOPT_REFRESH_ALL,
+            'posvals' => array(0 => 'red',
+                               1 => 'blue',
+                               2 => 'green',
+                               3 => 'orange'),
+            'save'    => 'save_plugin_demo_favorite_color'
+         );
+
   3.  If you indicated a 'save' attribute for any of your options, you must
       create that function (you'll only need to do this if you need to do
       some special processing for one of your settings).  The function gets
   3.  If you indicated a 'save' attribute for any of your options, you must
       create that function (you'll only need to do this if you need to do
       some special processing for one of your settings).  The function gets