You are here

function boxes_box_form_submit in Boxes 7

Same name and namespace in other branches
  1. 6 boxes.module \boxes_box_form_submit()

Submit handler for the inline form.

1 string reference to 'boxes_box_form_submit'
boxes_form_alter in ./boxes.module
Implements hook_form_alter().

File

./boxes.module, line 521
Core functionality for boxes module.

Code

function boxes_box_form_submit($form, $form_state) {
  if ($form_state['clicked_button']['#value'] == t('Cancel')) {
    return;
  }
  $box = boxes_factory($form_state['values']['plugin_key'], $form_state['values']);

  // if options_submit is defined let the box process the submit
  if (method_exists($box, 'options_submit')) {
    $box
      ->options_submit($form, $form_state);
  }

  // Let's set the additional_classes as an option
  $box->options['additional_classes'] = isset($form_state['values']['additional_classes']) ? $form_state['values']['additional_classes'] : array();
  if (module_exists('spaces') && ($space = spaces_get_space())) {
    $space->controllers->boxes
      ->set($box->delta, $box);
  }
  else {
    $box
      ->save();
  }
}