| 1 |
<?php |
<?php |
| 2 |
// $Id: rotor.module,v 1.2.2.18.2.30 2009/11/05 10:22:34 mrfelton Exp $ |
// $Id: rotor.module,v 1.2.2.18.2.31 2009/11/05 10:27:29 mrfelton Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 87 |
* Node form hook |
* Node form hook |
| 88 |
*/ |
*/ |
| 89 |
function rotor_form($node, &$param) { |
function rotor_form($node, &$param) { |
| 90 |
|
global $user; |
| 91 |
|
|
| 92 |
$form['title'] = array( |
$form['title'] = array( |
| 93 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 94 |
'#title' => t('Tab Text'), |
'#title' => t('Tab Text'), |
| 122 |
'#description' => 'The rotor image.', |
'#description' => 'The rotor image.', |
| 123 |
'#collapsible' => TRUE, |
'#collapsible' => TRUE, |
| 124 |
); |
); |
| 125 |
|
|
| 126 |
|
|
| 127 |
|
if (module_exists('upload')) { |
| 128 |
|
$upload_uploadsize_default = variable_get('upload_uploadsize_default', 1) * 1048576; |
| 129 |
|
$max_size = variable_get('upload_uploadsize_'. $user->rid, $upload_uploadsize_default); |
| 130 |
|
} |
| 131 |
|
|
| 132 |
$form['image']['rotor_image'] = array( |
$form['image']['rotor_image'] = array( |
| 133 |
'#type' => 'upload_element', |
'#type' => 'image_upload_element', |
| 134 |
'#title' => t('Rotor image'), |
'#title' => t('Rotor image'), |
| 135 |
'#default_value' => $node->fid, |
'#default_value' => $node->fid, |
|
'#image_formatter' => 'upload_element_image_preview', |
|
|
'#image_preview_size' => '100x100', |
|
| 136 |
'#file_validators' => array( |
'#file_validators' => array( |
| 137 |
'file_validate_size' => array(1048576), |
'file_validate_size' => !empty($max_size)? array($max_size) : NULL, |
|
'file_validate_extensions' => array('jpg jpeg png gif'), |
|
| 138 |
), |
), |
| 139 |
); |
); |
| 140 |
$form['image']['alt_text'] = array( |
$form['image']['alt_text'] = array( |