You are here

function text_field_presave in Scald: Media Management made easy 7

Implements hook_field_presave() on behalf of Text module.

@todo Find a better approach to avoid possible collision with other "tricky" modules. However we should be safe with Drupal 7 core.

File

modules/fields/mee/mee.module, line 269
Defines a special textarea, with drag and drop media driven by Scald and dnd.module.

Code

function text_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {

  // Convert rendered atom back to SAS for on the fly render if required.
  if (mee_store_format() != 'sas') {
    return;
  }
  foreach ($items as $delta => &$item) {
    if (!empty($item['value'])) {
      $item['value'] = scald_rendered_to_sas($item['value']);
    }
  }
}