You are here

function emfield_operations_reload in Embedded Media Field 6.3

Same name and namespace in other branches
  1. 5 emfield.module \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 string reference to 'emfield_operations_reload'
emfield_node_operations in deprecated/emfield-deprecated.inc
Implementation of hook_node_operations().

File

deprecated/emfield-deprecated.inc, line 829
Functionality to be deprecated from earlier versions of Embedded Media Field.

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);
        }
      }
    }
  }
}