function scald_image_scald_add_form in Scald: Media Management made easy 7
Implements hook_scald_add_form().
File
- modules/
providers/ scald_image/ scald_image.module, line 34 - Scald Image is a Scald Atom Provider for images.
Code
function scald_image_scald_add_form(&$form, &$form_state) {
$defaults = scald_atom_defaults('image');
$defaults->description = ScaldAtomController::getFieldDescription('image');
$defaults->upload_validators = ScaldAtomController::getFieldUploadValidators('image');
$type = scald_type_load('image');
$form['file'] = array(
'#type' => $defaults->upload_type,
'#title' => check_plain(scald_type_property_translate($type)),
'#upload_location' => ScaldAtomController::getThumbnailPath('image'),
'#upload_validators' => $defaults->upload_validators,
);
if ($defaults->upload_type === 'managed_file') {
$form['file']['#description'] = theme('file_upload_help', array(
'description' => $defaults->description,
'upload_validators' => $defaults->upload_validators,
));
}
if ($defaults->upload_type == 'plupload') {
$form['scald_authors'] = array(
'#type' => 'textfield',
'#default_value' => NULL,
'#maxlength' => 100,
'#autocomplete_path' => 'taxonomy/autocomplete/scald_authors',
'#required' => FALSE,
'#title' => t('Authors'),
'#description' => t('Preset value for %field_name field. If left empty, the default field value will be used.', array(
'%field_name' => t('Authors'),
)),
);
$form['scald_tags'] = array(
'#type' => 'textfield',
'#default_value' => NULL,
'#maxlength' => 100,
'#autocomplete_path' => 'taxonomy/autocomplete/scald_tags',
'#required' => FALSE,
'#title' => t('Tags'),
'#description' => t('Preset value for %field_name field. If left empty, the default field value will be used.', array(
'%field_name' => t('Tags'),
)),
);
}
}