You are here

function asset_process in Asset 6

File

inc/modules/asset_content.inc, line 316

Code

function asset_process($element, $edit, &$form_state, $form) {
  $items =& $form['#field_info'][$element['#field_name']];
  foreach ($items as $delta => $item) {
    if ($field['multiple'] == 1 && (empty($item['aid']) || !is_numeric($item['aid']))) {
      unset($items[$delta]);
      continue;
    }
    if (!empty($item['aid']) && is_numeric($item['aid'])) {
      if (!empty($item['value'])) {
        $items[$delta]['options'] = $item['value'];
      }
      else {
        $a = asset_load(array(
          'aid' => $item['aid'],
        ));
        $items[$delta]['options'] = $a->filename;
      }
      $items[$delta]['aid'] = $item['aid'];
      $items[$delta]['caption'] = $item['caption'] ? $item['caption'] : '';
      $items[$delta]['copyright'] = $item['copyright'] ? $item['copyright'] : '';
    }
  }
  return $items;
}