You are here

function emfield_operations_reload in Embedded Media Field 6

Same name and namespace in other branches
  1. 5 emfield.module \emfield_operations_reload()
  2. 6.3 deprecated/emfield-deprecated.inc \emfield_operations_reload()
  3. 6.2 emfield.module \emfield_operations_reload()

This reloads and saves the data for all the nid's in the array.

1 call to emfield_operations_reload()
theme_emvideo_bliptv_flash in contrib/emvideo/providers/bliptv.inc
1 string reference to 'emfield_operations_reload'
emfield_node_operations in ./emfield.module
Implementation of hook_node_operations().

File

./emfield.module, line 272
Embedded Media Field is a CCK-based framework for 3rd party media files.

Code

function emfield_operations_reload($nids = array(), $show_message = TRUE) {
  foreach ($nids as $nid) {
    if ($node = node_load($nid)) {
      $type = content_types($node->type);
      foreach ($type['fields'] as $field) {
        if (module_hook($field['type'], 'emfield_info')) {
          $message = "Reloaded %node-title's %field.";
          $message_variables = array(
            '%node-title' => $node->title,
            '%field' => $field['type_name'],
          );
          watchdog('emfield reload data', $message, $message_variables, WATCHDOG_NOTICE, l($node->title, 'node/' . $node->nid));
          if ($show_message) {
            drupal_set_message(t($message, $message_variables));
          }
          $items = $node->{$field['field_name']};
          emfield_emfield_field('submit', $node, $field, $items, FALSE, FALSE, $field['type']);
          $node->{$field['field_name']} = $items;
          node_save($node);
        }
      }
    }
  }
}