| 1 |
<?php |
<?php |
| 2 |
// $Id: addresses_names.module,v 1.1 2008/09/28 22:26:11 alexiswilke Exp $ |
// $Id: addresses_names.module,v 1.2 2008/12/28 19:21:10 alexiswilke Exp $ |
| 3 |
/** |
/** |
| 4 |
* @author Alexis Wilke |
* @author Alexis Wilke |
| 5 |
* @file addresses_names.module |
* @file addresses_names.module |
| 59 |
), |
), |
| 60 |
'token' => 'addresses_adr', |
'token' => 'addresses_adr', |
| 61 |
), |
), |
| 62 |
|
'category' => array( |
| 63 |
|
'type' => 'varchar', |
| 64 |
|
'length' => 75, |
| 65 |
|
'description' => t('Business Category'), |
| 66 |
|
'display' => ADDRESSES_FIELD_SHOW, |
| 67 |
|
'title' => t('Business Category'), |
| 68 |
|
'theme' => array( |
| 69 |
|
'business' => t('Business Category.'), |
| 70 |
|
), |
| 71 |
|
'token' => 'addresses_adr', |
| 72 |
|
), |
| 73 |
); |
); |
| 74 |
} |
} |
| 75 |
elseif ($op == 'form') { |
elseif ($op == 'form') { |
| 151 |
); |
); |
| 152 |
} |
} |
| 153 |
|
|
| 154 |
|
// Category |
| 155 |
|
if ($fields['category'] == ADDRESSES_FIELD_HIDDEN) { |
| 156 |
|
$form['category'] = array( |
| 157 |
|
'#type' => 'hidden', |
| 158 |
|
'#value' => isset($values['category']) ? $values['category'] : '', |
| 159 |
|
); |
| 160 |
|
} |
| 161 |
|
elseif (!empty($fields['category'])) { |
| 162 |
|
$form['category'] = array( |
| 163 |
|
'#type' => 'textfield', |
| 164 |
|
'#title' => t('Category'), |
| 165 |
|
'#default_value' => isset($values['category']) ? $values['category'] : '', |
| 166 |
|
'#size' => 50, |
| 167 |
|
'#maxlength' => 75, |
| 168 |
|
'#attributes' => NULL, |
| 169 |
|
'#required' => ($fields['category'] == ADDRESSES_FIELD_REQUIRED), |
| 170 |
|
); |
| 171 |
|
} |
| 172 |
|
|
| 173 |
return $form; |
return $form; |
| 174 |
} |
} |
| 175 |
} |
} |
| 181 |
*/ |
*/ |
| 182 |
function addresses_names_theme() { |
function addresses_names_theme() { |
| 183 |
return array( |
return array( |
|
'addresses_names_field_business' => array( |
|
|
'arguments' => array('form'), |
|
|
'file' => 'addresses_names.inc', |
|
|
), |
|
| 184 |
'addresses_names_field_first_name' => array( |
'addresses_names_field_first_name' => array( |
| 185 |
'arguments' => array('form'), |
'arguments' => array('form'), |
| 186 |
'file' => 'addresses_names.inc', |
'file' => 'addresses_names.inc', |
| 193 |
'arguments' => array('form'), |
'arguments' => array('form'), |
| 194 |
'file' => 'addresses_names.inc', |
'file' => 'addresses_names.inc', |
| 195 |
), |
), |
| 196 |
|
'addresses_names_field_business' => array( |
| 197 |
|
'arguments' => array('form'), |
| 198 |
|
'file' => 'addresses_names.inc', |
| 199 |
|
), |
| 200 |
|
'addresses_names_field_category' => array( |
| 201 |
|
'arguments' => array('form'), |
| 202 |
|
'file' => 'addresses_names.inc', |
| 203 |
|
), |
| 204 |
); |
); |
| 205 |
} |
} |
| 206 |
|
|
| 217 |
} |
} |
| 218 |
elseif ($type == 'addresses_adr') { |
elseif ($type == 'addresses_adr') { |
| 219 |
$values['business'] = empty($object['business']) ? '' : theme('addresses_names_field_business', $object); |
$values['business'] = empty($object['business']) ? '' : theme('addresses_names_field_business', $object); |
| 220 |
|
$values['category'] = empty($object['category']) ? '' : theme('addresses_names_field_category', $object); |
| 221 |
return $values; |
return $values; |
| 222 |
} |
} |
| 223 |
} |
} |