Submit drupal form & node_save using hook_submit_form in Drupal 7
Submit drupal form & node_save using hook_submit_form in Drupal 7
function MODULE_NAME_theme() {
return array(
'MODULE_NAME_image' => array(
'render element' => 'form',
),
);
}
function theme_MODULE_NAME_image($variables) {
$form = $variables['form'];
if(isset($form['#file']->uri))
$form['identity_image']['#markup'] = theme('image_style', array('style_name' => 'thumbnail', 'path' => file_build_uri(file_uri_target($form['#file']->uri))));
$output = drupal_render_children($form);
return $output;
}
function MODULE_NAME_form($form, &$form_state) {
$form = array();
$form = array();
$form['identity_image'] = array(
'#title' => t('Upload photo document'),
'#type' => 'managed_file',
'#required' => true,
'#upload_location' => 'public://identity/'.$order->uid.'/',
'#upload_validators' => array(
'file_validate_extensions' => array('jpg png jpeg'),
),
'#theme' => 'MODULE_NAME_image',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Approved'),
);
return $form;
}
Post a Comment