You are here

function library_node_form_submit in Library 7

Same name and namespace in other branches
  1. 5.2 library.module \library_node_form_submit()
  2. 6.2 library.module \library_node_form_submit()
  3. 6 library.module \library_node_form_submit()

Submits the node form for nodes with items.

Gets the node object, modifies the title, and updates the node in the form_state.

Parameters

array $form: Regular form array.

array $form_state: Regular form_state array being modified.

1 string reference to 'library_node_form_submit'
library_form_alter in ./library.module
Implements hook_form_alter().

File

./library.module, line 242

Code

function library_node_form_submit($form, &$form_state) {
  if (variable_get('library_item_barcodes', LIBRARY_NO_BARCODES) == LIBRARY_BARCODES) {
    $items = $form_state['values']['library_items'];
    $row = 0;
    $last_key = count($items) - 1;
    foreach ($items as $key => $item) {

      // Remove empty item instance if it's not being used.
      if ($key > 0 && $key == $last_key && empty($item['id']) && empty($item['barcode'])) {
        unset($form_state['values']['library_items'][$key]);
      }
      $row++;
    }
  }
}