You are here

function _iframe_process in Iframe 6

1 call to _iframe_process()
iframe_field in ./iframe.module
Implementation of hook_field().

File

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

Code

function _iframe_process(&$item, $delta = 0, $field, $node) {
  dmsg(3, 'func _iframe_process');

  // Trim whitespace from url.
  $item['url'] = trim($item['url']);

  // numbers should be numbers
  $item['attributes']['width'] = iframe_validate_size($item['attributes']['width'], $field['widget']['default_value'][$delta]['width']);
  $item['attributes']['height'] = iframe_validate_size($item['attributes']['height'], $field['widget']['default_value'][$delta]['height']);

  // Serialize the attributes array.
  $item['attributes'] = serialize($item['attributes']);

  // Don't save an invalid default value (e.g. 'http://').
  if (isset($field['widget']['default_value'][$delta]['url']) && $item['url'] == $field['widget']['default_value'][$delta]['url'] && is_object($node)) {
    if (!iframe_validate_url($item['url'])) {
      unset($item['url']);
    }
  }
}