You are here

function nodesymlinks_node_form_submit_delete in NodeSymlinks 7

Same name and namespace in other branches
  1. 6 nodesymlinks.inc \nodesymlinks_node_form_submit_delete()

Delete selected symlinks items, submit handler for symlinks at node form.

See also

nodesymlinks_form_alter()

1 string reference to 'nodesymlinks_node_form_submit_delete'
_nodesymlinks_node_form_alter in ./nodesymlinks.inc
Implements hook_form_alter().

File

./nodesymlinks.inc, line 484
Main NodeSymlinks callbacks

Code

function nodesymlinks_node_form_submit_delete($form, &$form_state) {

  // Set the form to rebuild and run submit handlers.
  if ($_GET['q'] != 'system/ajax') {
    node_form_submit_build_node($form, $form_state);
  }
  $form_state['rebuild'] = TRUE;
  if ($form_state['clicked_button']['#value'] == $form['menu']['nodesymlinks']['delete']['#value']) {
    $item_keys = element_children($form['menu']['nodesymlinks']['items']);
    $values_items =& $form_state['values']['menu']['nodesymlinks']['items'];
    $delete_count = 0;
    foreach ($item_keys as $delta) {
      if (!empty($values_items[$delta]['delete'])) {
        $delete_count++;
      }
    }
    $form_state['nodesymlinks']['item_count'] = -$delete_count;
  }
}