Created
December 3, 2010 18:54
-
-
Save mraaroncruz/727363 to your computer and use it in GitHub Desktop.
i want my widget!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
** | |
* Implementation of hook_form(); | |
*/ | |
// THIS CODE DOESN'T WORK!!! well, i mean, it works, but id doesn't do what it is supposed to do... | |
function community_form(&$node, $form_state) { | |
$type = node_get_types('type', $node); | |
// We need to define form elements for the node's title and body. | |
$form['title'] = array( | |
'#type' => 'textfield', | |
'#title' => t('Name of Clothing Item From Picture'), | |
'#required' => TRUE, | |
'#default_value' => $node->title, | |
'#weight' => -5 | |
); | |
// Clothing Image | |
$form['image'] = array( | |
'#type' => 'fieldset', | |
'#title' => t('Customer Image') | |
); | |
$form['image']['community_image_upload'] = array( | |
'#type' => 'file', | |
'#title' => t('Upload image'), | |
'#size' => 48, | |
'#default_value' => $edit['community_image_upload'], | |
'#description' => t( | |
'Maximum dimensions are %dimensions and the maximum size is %size kB.', | |
array( | |
'%dimensions' => '250x250', | |
'%size' => '30' | |
) | |
) | |
); | |
// Here it is, i also tried without the ['image']['community_image_upload'] part... no luck | |
$form['image']['community_image_upload']['preview']['#value'] = theme('imagefield_widget_preview',$form['#value']); | |
$form['#validate'][] = 'community_form_validate'; | |
$form['#attributes']['enctype'] = 'multipart/form-data'; | |
// NOTE in node_example there is some addition code here not needed for this simple node-type | |
return $form; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment