/[drupal]/contributions/modules/valuelist/README.txt
ViewVC logotype

Diff of /contributions/modules/valuelist/README.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Tue Feb 26 15:28:39 2008 UTC revision 1.1.2.1, Tue Feb 26 15:28:39 2008 UTC
# Line 0  Line 1 
1    // $Id$
2    
3    DESCRIPTION
4    -----------
5    This is a module which provides an interface for managing value lists in
6    fringe use cases where CCK is not being used to define select element
7    options. For example, if you have a situation where you have a
8    programatically-defined form with select elements that an end user needs
9    to be able to adjust over time, this module allows you to define those
10    lists via Drupal, then grant access to edit those lists to other users.
11    
12    INSTALLATION
13    ------------
14    Place the entire 'valuelist' directory into your site's 'modules'
15    directory (e.g. sites/all/modules).  While logged into your Drupal site
16    as an administrator, go to the http://mysite.com/admin/build/modules page,
17    check the box next to 'Value List', and click 'Save Configuration'.
18    Module permissions may then be configured by going to
19    http://mysite.com/admin/user/access#module-valuelist.
20    
21    MANAGING VALUE LISTS
22    --------------------
23    Value lists can be managed at http://mysite.com/admin/build/valuelist.
24    
25    Enter one value per line, in the format 'value|label', where 'value' is
26    the actual value that will be submitted with the form, and 'label' is
27    the string that will be displayed in the select pull-down.
28    
29    If value and label are the same, just enter a single string.
30    
31    USING VALUE LISTS IN FORMS
32    --------------------------
33    Once you have defined a value list, you can retrieve that list as an
34    associative array suitable for use in a Form API 'select' element using
35    the valuelist_get_array() function.  For example, take a value list called
36    "instruments" with the following values:
37    
38    bjo|Banjo
39    gtr|Guitar
40    mdo|Mandolin
41    
42    A 'select' element using this value list would look something like this:
43    
44    <?php
45    $form['instruments'] = array(
46      '#type' => 'select',
47      '#title' => t('Instruments'),
48      '#options' => valuelist_get_array('instruments')
49    );
50    ?>
51    
52    '#options' will now contain an associative array:
53    
54    array('bjo' => 'Banjo', 'gtr' => 'Guitar', 'mdo' => 'Mandolin)
55    
56    Label values are run through the t() function.
57    
58    CREDITS
59    -------
60    Developed and maintained by Andy Chase <http://proofgroup.com>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

  ViewVC Help
Powered by ViewVC 1.1.2