You are here

function iframe_field_presave in Iframe 7

Implements hook_field_presave().

We have to populate all missing default-values which were defined, but not edited by the current author ($entity can be manipulated, because it shows only to the object) (entity_type: "node", entity: node-object, field: (field-settings + field-inst-settings) ..., items: current-items-of-page)

File

./iframe.module, line 272
Defines an iframe field with all attributes.

Code

function iframe_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
  $settings = $instance['settings'];
  $settings += $field['settings'];
  if ($field['type'] == 'iframe') {
    foreach ($items as $delta => $item) {
      if (isset($item['url'])) {

        // fill in missing attributes for saving
        $items[$delta] = $items[$delta] + $settings;
      }
    }
    iframe_debug(2, 'iframe_field_presave', array(
      'entity_type' => $entity_type,
      'entity' => $entity,
      'field' => $field,
      'instance' => $instance,
      'items' => $items,
    ));
  }
}