You are here

function editableviews_entity_form_submit_save in Editable Views 7

Form submit handler the second: save entities.

Saves all entities in $form_state['entities'], with the exception of new entities which have their 'editableviews_needs_save' set to FALSE. If batch support is enabled, batch is triggered from here.

1 string reference to 'editableviews_entity_form_submit_save'
editableviews_entity_form in ./editableviews.module
Form builder for an editable view.

File

./editableviews.module, line 299
editableviews.module Contain module code. @todo:

Code

function editableviews_entity_form_submit_save($form, &$form_state) {
  if (!$form['#batch']) {
    editableviews_entity_save($form_state['entities'], $form['#save_messages']);
  }
  else {
    $operations = array();
    $entities = $form_state['entities'];
    foreach (array_keys($entities) as $entity_type) {
      $entity_array = $entities[$entity_type];
      while (!empty($entity_array)) {
        $list = array_splice($entity_array, 0, $form['#batch_size']);
        $operations[] = array(
          'editableviews_entity_save',
          array(
            array(
              $entity_type => $list,
            ),
            $form['#save_messages'],
          ),
        );
      }
    }
    $batch = array(
      'operations' => $operations,
      'finished' => 'editableviews_save_batch_finished',
    );
    batch_set($batch);
  }
}