You are here

function cmf_admin_nodes_form_submit in Content Management Filter 6

Same name and namespace in other branches
  1. 5 node.inc \cmf_admin_nodes_form_submit()
  2. 6.2 node.inc \cmf_admin_nodes_form_submit()
  3. 7 node.inc \cmf_admin_nodes_form_submit()

Handle post-validation form submission. \n Execute the chosen 'Update option' on the selected nodes, such as publishing, unpublishing, promotion and stickness status or deleting.

Parameters

the ID of the passed form:

array with the form properties values:

See also

cmf_admin_nodes_form()

cmf_admin_nodes_form_validate()

File

./node.inc, line 145
@brief Content management filter node operations file,

Code

function cmf_admin_nodes_form_submit($form, &$form_state) {
  $operations = module_invoke_all('node_operations');
  $operation = $operations[$form_state['values']['operation']];

  // Filter out unchecked nodes.
  $nodes = array_filter($form_state['values']['nodes']);
  if ($function = $operation['callback']) {

    // Add in callback arguments if present.
    if (isset($operation['callback arguments'])) {
      $args = array_merge(array(
        $nodes,
      ), $operation['callback arguments']);
    }
    else {
      $args = array(
        $nodes,
      );
    }
    call_user_func_array($function, $args);
    cache_clear_all();
    drupal_set_message(t('The update has been performed.'));
    if (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) > 0) {
      $form_state['redirect'] = 'user/' . arg(1) . '/cmf';
    }
    else {
      $form_state['redirect'] = 'admin/content/filter';
    }
  }
}