You are here

function asset_file_form in Asset 5.2

Same name and namespace in other branches
  1. 6 asset.types.inc \asset_file_form()

Implementation of hook_asset_type('form') for file asset type

Related topics

File

./asset.types.inc, line 44
This file is included by asset_asset_type() and includes all the file and directory specific functions

Code

function asset_file_form($asset) {
  if ($asset->file['fid']) {
    $form['_upload'] = array(
      '#type' => 'item',
      '#value' => $asset->file['filename'],
      '#title' => t('Current file'),
    );
    $overwrite = t('This will replace any files that have been uploaded previously.');
  }
  $form['upload'] = array(
    '#type' => 'file',
    '#title' => t('Attach new file'),
    '#description' => $overwrite ? $overwrite : NULL,
    '#size' => 25,
  );
  if ($options = _asset_file_localfile_options()) {
    $form['localfile'] = array(
      '#type' => 'select',
      '#title' => t('Or select a file'),
      '#options' => $options,
    );
  }
  $form['#attributes']['enctype'] = 'multipart/form-data';
  return $form;
}