You are here

function nodeorder_admin_display_form_submit in Node Order 7

Same name and namespace in other branches
  1. 6 nodeorder.admin.inc \nodeorder_admin_display_form_submit()

Process main blocks administration form submission.

File

includes/nodeorder.admin.inc, line 103
Admin page callbacks for the nodeorder module.

Code

function nodeorder_admin_display_form_submit($form, &$form_state) {
  $tid = $form['#term']->tid;
  foreach ($form_state['values'] as $key => $node) {

    // Only take form elements that are blocks.
    if (is_array($node) && array_key_exists('weight', $node)) {
      $nid = $form[$key]['#node']->nid;
      db_update('taxonomy_index')
        ->fields(array(
        'weight' => $node['weight'],
      ))
        ->condition('tid', $tid)
        ->condition('nid', $nid)
        ->execute();
    }
  }
  drupal_set_message(t('The node orders have been updated.'));
  cache_clear_all();
  return;
}