audiofield_field

Versions
5
audiofield_field($op, $node, $field, &$node_field, $a1, $a2)

Implementation of hook_field().

▾ 1 function calls audiofield_field()

audiofield_js in contributions/mediafield/audiofield.module
Menu callback for JavaScript-based uploads.

Code

contributions/mediafield/audiofield.module, line 41

<?php
function audiofield_field($op, $node, $field, &$node_field, $a1, $a2) {
  require_once(drupal_get_path('module', 'audiofield') .'/multimediafile.inc');
  $fieldname = $field['field_name'];
  switch ($op) {
    case 'load':
      $output = array();
      if (count($node_field)) {
        $values = array();
        foreach ($node_field as $delta => $file) {
          if (!empty($file)) {
            $values[$delta]  = array_merge($node_field[$delta], _field_file_load($file['fid']));
            $node_field[$delta] = $values[$delta];
          }
          $output = array($fieldname => $values);
        }
      }
      break;

    case 'view':
      $files = array();
      foreach ($node_field as $delta => $item) {
          $node_field[$delta]['view'] = content_format($field, $item, 'default');
      }
      $output = theme('field', $node, $field, $node_field, $a1, $a2);
      break;

    case 'insert':
      foreach ($node_field as  $delta => $item) {
        $node_field[$delta] = _field_file_insert($node, $item, $field);
      }
      break;

    case 'update':
      foreach ($node_field as $delta => $item) {
        $node_field[$delta] = _field_file_update($node, $item, $field);
      }
      break;

    case 'delete':
      foreach ($node_field as $delta => $item) {
        _field_file_delete($item, $field['field_name'], $field['type']);
      }
      break;
  }
  return $output;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.