| 155 |
|
|
| 156 |
function i_ching_form(&$node) { |
function i_ching_form(&$node) { |
| 157 |
// The site admin can decide if this node type has a title and body, and how |
// The site admin can decide if this node type has a title and body, and how |
| 158 |
// the fields should be labeled. We need to load these settings so we can |
// ·the fields should be labeled. We need to load these settings so we can |
| 159 |
// build the node form correctly. |
// build the node form correctly. |
| 160 |
$type = node_get_types('type', $node); |
$type = node_get_types('type', $node); |
| 161 |
|
|
| 165 |
'#title' => check_plain($type->title_label), |
'#title' => check_plain($type->title_label), |
| 166 |
'#required' => TRUE, |
'#required' => TRUE, |
| 167 |
'#default_value' => $node->title, |
'#default_value' => $node->title, |
| 168 |
'#weight' => -5 |
'#weight' => -8 |
| 169 |
); |
); |
| 170 |
} |
} |
| 171 |
|
|
| 191 |
'2' => t('- - (2 heads)'), |
'2' => t('- - (2 heads)'), |
| 192 |
), |
), |
| 193 |
'#required' => TRUE, |
'#required' => TRUE, |
| 194 |
'#weight' => -1 |
'#weight' => -6 |
| 195 |
); |
); |
| 196 |
|
|
| 197 |
$form['line_5'] = array( |
$form['line_5'] = array( |
| 206 |
'2' => t('- - (2 heads)'), |
'2' => t('- - (2 heads)'), |
| 207 |
), |
), |
| 208 |
'#required' => TRUE, |
'#required' => TRUE, |
| 209 |
'#weight' => -1 |
'#weight' => -5 |
| 210 |
); |
); |
| 211 |
|
|
| 212 |
$form['line_4'] = array( |
$form['line_4'] = array( |
| 221 |
'2' => t('- - (2 heads)'), |
'2' => t('- - (2 heads)'), |
| 222 |
), |
), |
| 223 |
'#required' => TRUE, |
'#required' => TRUE, |
| 224 |
'#weight' => -1 |
'#weight' => -4 |
| 225 |
); |
); |
| 226 |
|
|
| 227 |
$form['line_3'] = array( |
$form['line_3'] = array( |
| 236 |
'2' => t('- - (2 heads)'), |
'2' => t('- - (2 heads)'), |
| 237 |
), |
), |
| 238 |
'#required' => TRUE, |
'#required' => TRUE, |
| 239 |
'#weight' => -1 |
'#weight' => -3 |
| 240 |
); |
); |
| 241 |
|
|
| 242 |
$form['line_2'] = array( |
$form['line_2'] = array( |
| 251 |
'2' => t('- - (2 heads)'), |
'2' => t('- - (2 heads)'), |
| 252 |
), |
), |
| 253 |
'#required' => TRUE, |
'#required' => TRUE, |
| 254 |
'#weight' => -1 |
'#weight' => -2 |
| 255 |
); |
); |
| 256 |
|
|
| 257 |
$form['line_1'] = array( |
$form['line_1'] = array( |
| 268 |
'#required' => TRUE, |
'#required' => TRUE, |
| 269 |
'#weight' => -1 |
'#weight' => -1 |
| 270 |
); |
); |
| 271 |
|
|
| 272 |
return $form; |
return $form; |
| 273 |
} |
} |
| 274 |
|
|
| 275 |
|
|
| 276 |
|
|
| 277 |
|
function i_ching_form_alter(&$form, &$form_state, $form_id) { |
| 278 |
|
if ($form_id == 'i_ching_node_form') { |
| 279 |
|
// Form modification code goes here; $form_state cannot be modified, |
| 280 |
|
// but decisions can be made based on its contents. |
| 281 |
|
$form['taxonomy']['#weight']=-7; |
| 282 |
|
$form['menu']['#weight']=1; |
| 283 |
|
} |
| 284 |
|
} |
| 285 |
|
|
| 286 |
|
|
| 287 |
|
|
| 288 |
/** |
/** |
| 289 |
* Implementation of hook_validate(). |
* Implementation of hook_validate(). |
| 290 |
* Errors should be signaled with form_set_error(). |
* Errors should be signaled with form_set_error(). |
| 299 |
// Let an empty field mean "zero." |
// Let an empty field mean "zero." |
| 300 |
$node->quantity = 0; |
$node->quantity = 0; |
| 301 |
} |
} |
| 302 |
|
drupal_set_message('<pre>'. print_r(get_defined_vars(), 1) .'</pre>'); |
| 303 |
|
|
| 304 |
} |
} |
| 305 |
|
|
| 306 |
/** |
/** |