/[drupal]/contributions/modules/prepopulate/prepopulate.module
ViewVC logotype

Diff of /contributions/modules/prepopulate/prepopulate.module

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

revision 1.5.2.1, Wed Mar 12 16:40:38 2008 UTC revision 1.5.2.2, Mon Nov 17 17:52:57 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: prepopulate.module,v 1.5 2006/08/30 23:12:18 eafarris Exp $  // $Id: prepopulate.module,v 1.5.2.1 2008/03/12 16:40:38 add1sun Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 16  Line 16 
16  function prepopulate_help($section) {  function prepopulate_help($section) {
17    switch($section) {    switch($section) {
18      case 'admin/modules#description':      case 'admin/modules#description':
19        return t('Pre-populates forms for allowed content types with HTTP GET data');        return t('Pre-populates forms with HTTP GET data');
20        break;        break;
21    } // endswitch $section    } // endswitch $section
22  } // endfunction prepopulate_help()  } // endfunction prepopulate_help()
# Line 27  function prepopulate_help($section) { Line 27  function prepopulate_help($section) {
27  function prepopulate_form_alter($form_id, &$form) {  function prepopulate_form_alter($form_id, &$form) {
28    $node = $form['#node'];    $node = $form['#node'];
29    
30    switch ($form_id) {    if (isset($_GET['edit'])) {
31      // On a node settings form, praise be to the FormsAPI!      foreach (array_keys((array)$_GET['edit']) as $getvar) {
32      case 'node_type_form':        if (element_child($getvar) && !is_null($form[$getvar])) {
33        $type = $form['#node_type']->type;          _prepopulate_get_walk($form[$getvar], $_GET['edit'][$getvar]);
34        $form['workflow']['prepopulate_allowed'] = array(        }
35          '#type' => 'checkbox',      }
         '#title' => 'Prepopulate form from URL?',  
         '#default_value' => variable_get('prepopulate_allowed_' . $type, TRUE),  
         '#description' => t('Allows fields to be prepopulated from the URL'),  
       );  
     return;  
   } // endswitch $form_id  
   
   if (isset($node)) {  
     if (variable_get('prepopulate_allowed_'. $node->type, TRUE) && $_GET['edit']) {  
       foreach (array_keys((array)$_GET['edit']) as $getvar) {  
         if (element_child($getvar) && !is_null($form[$getvar])) {  
           _prepopulate_get_walk($form[$getvar], $_GET['edit'][$getvar]);  
         }  
       } // endforeach get variable  
     } // endif any get vars  
36    }    }
37    
38  } // endfunction prepopulate_form_alter()  } // endfunction prepopulate_form_alter()

Legend:
Removed from v.1.5.2.1  
changed lines
  Added in v.1.5.2.2

  ViewVC Help
Powered by ViewVC 1.1.2