You are here

function emfield_operations_reload in Embedded Media Field 5

Same name and namespace in other branches
  1. 6.3 deprecated/emfield-deprecated.inc \emfield_operations_reload()
  2. 6 emfield.module \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_video_cck_bliptv_flash in contrib/video_cck/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 546

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 = t("Reloaded %node-title's %field.", array(
            '%node-title' => $node->title,
            '%field' => $field['type_name'],
          ));
          watchdog('emfield reload data', $message, WATCHDOG_NOTICE, l($node->title, 'node/' . $node->nid));
          if ($show_message) {
            drupal_set_message($message);
          }
          $items = $node->{$field['field_name']};
          emfield_emfield_field('submit', $node, $field, $items, FALSE, FALSE, $field['type']);
          $node->{$field['field_name']} = $items;
          node_save($node);
        }
      }
    }
  }
}