function media_watermark_form in Media watermark 7
Form constructor for the media watermark form.
See also
media_watermark_form_validate()
1 string reference to 'media_watermark_form'
- media_watermark_menu in ./
media_watermark.module - Implements hook_menu().
File
- includes/
media_watermark_add.admin.inc, line 17 - Media watermark module integration.
Code
function media_watermark_form($form, &$form_state) {
if (arg(5)) {
drupal_set_title(t('Edit watermark'));
$values = media_watermark_get_watermark(arg(5));
}
$form['#attributes'] = array(
'enctype' => "multipart/form-data",
);
$form['watermark_image'] = array(
'#type' => 'managed_file',
'#title' => t('Watermark image'),
'#upload_location' => 'public://watermark',
'#upload_validators' => array(
'file_validate_extensions' => array(
'png gif',
),
),
'#description' => t('allowed files extensions are .png and .gif'),
'#required' => TRUE,
'#default_value' => isset($values->fid) ? $values->fid : '',
);
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#default_value' => isset($values->name) ? $values->name : '',
'#description' => t('Set watermark name.'),
'#required' => TRUE,
);
$form['hor_position'] = array(
'#type' => 'select',
'#title' => t('Horizontal position of watermark'),
'#options' => array(
'left' => t('left'),
'middle' => t('middle'),
'right' => t('right'),
),
'#default_value' => isset($values->hor_position) ? $values->hor_position : 'left',
'#required' => TRUE,
);
$form['ver_position'] = array(
'#type' => 'select',
'#title' => t('Vertical position of watermark'),
'#options' => array(
'top' => t('top'),
'center' => t('center'),
'bottom' => t('bottom'),
),
'#default_value' => isset($values->ver_position) ? $values->ver_position : 'bottom',
'#required' => TRUE,
);
$form['hor_margin'] = array(
'#type' => 'textfield',
'#title' => t('Horizontal margin, px'),
'#default_value' => isset($values->hor_margin) ? $values->hor_margin : '0',
'#description' => t('Set minus or plus signed value for moving watermark to left or right from defined position.'),
'#required' => TRUE,
);
$form['ver_margin'] = array(
'#type' => 'textfield',
'#title' => t('Vertical margin, px'),
'#default_value' => isset($values->ver_margin) ? $values->ver_margin : '0',
'#description' => t('Set minus or plus signed value for moving watermark to higher or lower from defined position.'),
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}