You are here

function asset_field in Asset 5

Same name and namespace in other branches
  1. 5.2 modules/asset_content.inc \asset_field()
  2. 6 modules/asset_content.inc \asset_field()

Implementation of hook_field().

File

modules/asset_content.inc, line 94

Code

function asset_field($op, &$node, $field, &$items, $teaser, $page) {
  switch ($op) {
    case 'load':
      $additions = array();

      // Return assets in a structured array for ease of use during theming
      foreach ($items as $delta => $item) {
        $asset = asset_load(array(
          'aid' => $item['aid'],
        ));
        $field_name = $field['field_name'];
        $additions['asset_by']['extension'][$field_name][$asset->extension][] = $asset;
        $additions['asset_by']['type'][$field_name][$asset->type][] = $asset;
      }
      return $additions;
      break;
  }
}