You are here

function iframe_field in Iframe 6

Implementation of hook_field().

File

./iframe.module, line 214
Defines simple iframe field types. based on the cck-module "link" by quicksketch MODULE-Funtions

Code

function iframe_field($op, &$node, $field, &$items, $teaser, $page) {
  dmsg(3, 'func iframe_field op=' . $op . ' field=' . $field);
  switch ($op) {
    case 'load':
      foreach ($items as $delta => $item) {
        _iframe_load($items[$delta], $delta);
      }
      break;
    case 'validate':
      $optional_field_found = FALSE;
      foreach ($items as $delta => $value) {
        _iframe_validate($items[$delta], $delta, $field, $node, $optional_field_found);
      }
      if ($field['url'] == 'optional' && $field['title'] == 'optional' && $field['required'] && !$optional_field_found) {
        form_set_error($field['field_name'] . '][0][title', t('At least one title or URL must be entered.'));
      }
      break;
    case 'presave':
      foreach ($items as $delta => $value) {
        _iframe_process($items[$delta], $delta, $field, $node);
      }
      break;
    case 'sanitize':
      foreach ($items as $delta => $value) {
        _iframe_sanitize($items[$delta], $delta, $field, $node);
      }
      break;
  }
}