function rotor_form in Rotor Banner 6.2
Same name and namespace in other branches
- 5.7 rotor.module \rotor_form()
- 5 rotor.module \rotor_form()
- 6 rotor.module \rotor_form()
- 7 rotor.module \rotor_form()
Node form hook
File
- ./
rotor.module, line 87 - A rotor banner consists in a set of images that will be changing. This module is made using jquery.
Code
function rotor_form($node, &$param) {
global $user;
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Tab Text'),
'#required' => TRUE,
'#default_value' => $node->title,
'#description' => t('The text that will be shown in the tab for this item.'),
);
$target_options = array(
'default' => t('Default (no target attribute)'),
'_top' => t('Open link in window root (_top)'),
'_blank' => t('Open link in new window (_blank)'),
);
$form['url'] = array(
'#type' => 'textfield',
'#title' => t('Link URL'),
'#default_value' => $node->url,
'#description' => t('The link that will be actived for this item. Example: http://www.drupal.org, node/3'),
'#weight' => -4,
);
$form['link_target'] = array(
'#type' => 'select',
'#title' => t('Link target'),
'#options' => $target_options,
'#default_value' => $node->link_target,
'#description' => t('The target of the link'),
'#weight' => -3,
);
$form['image'] = array(
'#type' => 'fieldset',
'#title' => 'Rotor image',
'#description' => 'The rotor image.',
'#collapsible' => TRUE,
);
if (module_exists('upload')) {
$file_limit = variable_get('upload_uploadsize_default', 1);
foreach ($user->roles as $rid => $name) {
// A zero value indicates no limit, take the least restrictive limit.
$file_size = variable_get("upload_uploadsize_{$rid}", variable_get('upload_uploadsize_default', 1)) * 1024 * 1024;
$file_limit = $file_limit && $file_size ? max($file_limit, $file_size) : 0;
}
}
$form['image']['rotor_image'] = array(
'#type' => 'image_upload_element',
'#title' => t('Rotor image'),
'#default_value' => $node->fid,
);
if (!empty($file_limit)) {
$form['image']['rotor_image']['#file_validators'] = array(
'file_validate_size' => array(
$file_limit,
),
);
}
$form['image']['alt_text'] = array(
'#type' => 'textfield',
'#title' => t('Alt text'),
'#default_value' => $node->alt_text,
'#description' => t('That alt text for the image.'),
);
$form['image']['image_title'] = array(
'#type' => 'textfield',
'#title' => t('Image title'),
'#default_value' => $node->image_title,
'#description' => t('That image title. This will be displayed when the mouse is hovered over the image.'),
);
$form['body_filter']['body'] = array(
'#type' => 'textarea',
'#title' => t('Content'),
'#default_value' => $node->body,
'#rows' => 10,
'#weight' => -3,
'#description' => t('The content that will be shown in case no image is uploaded.'),
);
$form['body_filter']['format'] = filter_form($node->format);
$form['#attributes']['enctype'] = 'multipart/form-data';
$form['#submit'] = array(
'rotor_submit',
);
return $form;
}