/[drupal]/contributions/modules/addresses/addresses_phone/addresses_phone.module
ViewVC logotype

Diff of /contributions/modules/addresses/addresses_phone/addresses_phone.module

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

revision 1.9, Sat Jan 10 07:10:34 2009 UTC revision 1.10, Tue Jan 20 20:31:42 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: addresses_phone.module,v 1.8 2009/01/08 07:57:45 brmassa Exp $  // $Id: addresses_phone.module,v 1.9 2009/01/10 07:10:34 brmassa Exp $
3  /**  /**
4   * @author Bruno Massa   * @author Bruno Massa
5   * @file   * @file
# Line 40  function addresses_phone_addressesfielda Line 40  function addresses_phone_addressesfielda
40      );      );
41    }    }
42    elseif ($op == 'form') {    elseif ($op == 'form') {
43        $field_weights = variable_get('addresses_field_weight', array());
44    
45      // Telephone number      // Telephone number
46      if ($fields['phone'] == ADDRESSES_FIELD_HIDDEN) {      if (!empty($fields['phone'])) {
       $form['phone'] = array(  
         '#type'           => 'hidden',  
         '#value'          => isset($values['phone']) ? $values['phone'] : '',  
       );  
     }  
     elseif (!empty($fields['phone'])) {  
47        $form['phone'] = array(        $form['phone'] = array(
48          '#type'           => 'textfield',          '#type'           => 'textfield',
49          '#title'          => t('Phone'),          '#title'          => t('Phone'),
# Line 55  function addresses_phone_addressesfielda Line 51  function addresses_phone_addressesfielda
51          '#size'           => 50,          '#size'           => 50,
52          '#maxlength'      => 75,          '#maxlength'      => 75,
53          '#attributes'     => NULL,          '#attributes'     => NULL,
54          '#required'       => ($fields['phone'] == ADDRESSES_FIELD_REQUIRED)          '#required'       => ($fields['phone'] == ADDRESSES_FIELD_REQUIRED),
55            '#weight'         => empty($field_weights['phone']['weight']) ? 0 :
56              $field_weights['phone']['weight'],
57        );        );
58      }      }
59    
60      // Fax number      // Fax number
61      if ($fields['fax'] == ADDRESSES_FIELD_HIDDEN) {      if (!empty($fields['fax'])) {
       $form['fax'] = array(  
         '#type'           => 'hidden',  
         '#value'          => isset($values['fax']) ? $values['fax'] : '',  
       );  
     }  
     elseif (!empty($fields['fax'])) {  
62        $form['fax'] = array(        $form['fax'] = array(
63          '#type'           => 'textfield',          '#type'           => 'textfield',
64          '#title'          => t('Fax'),          '#title'          => t('Fax'),
# Line 74  function addresses_phone_addressesfielda Line 66  function addresses_phone_addressesfielda
66          '#size'           => 50,          '#size'           => 50,
67          '#maxlength'      => 75,          '#maxlength'      => 75,
68          '#attributes'     => NULL,          '#attributes'     => NULL,
69          '#required'       => ($fields['fax'] == ADDRESSES_FIELD_REQUIRED)          '#required'       => ($fields['fax'] == ADDRESSES_FIELD_REQUIRED),
70            '#weight'         => empty($field_weights['fax']['weight']) ? 0 :
71              $field_weights['fax']['weight'],
72        );        );
73      }      }
74    
75        foreach (array_keys($fields) as $ftype) {
76          if ($fields[$ftype] == ADDRESSES_FIELD_HIDDEN) {
77            $form[$ftype] = array(
78              '#type'           => 'hidden',
79              '#value'          => isset($values[$ftype]) ? $values[$ftype] : '',
80            );
81          }
82        }
83    
84      return $form;      return $form;
85    }    }
86  }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.2