You are here

public function CommerceLicenseInlineEntityFormController::entityFormSubmit in Commerce License 7

Overrides EntityInlineEntityFormController::entityFormSubmit().

Overrides EntityInlineEntityFormController::entityFormSubmit

File

includes/commerce_license.inline_entity_form.inc, line 77
Defines the IEF controller for the commerce_license entity type.

Class

CommerceLicenseInlineEntityFormController
@file Defines the IEF controller for the commerce_license entity type.

Code

public function entityFormSubmit(&$entity_form, &$form_state) {
  $license = $entity_form['#entity'];

  // If IEF is being shown on an order form, use it to get the uid.
  if (!empty($form_state['commerce_order'])) {
    $license->uid = $form_state['commerce_order']->uid;
  }
  else {
    $license->uid = $GLOBALS['user']->uid;
  }

  // $license->product_id is maintained by
  // commerce_license_commerce_line_item_presave().
  // Only submit the form if the license is configurable.
  if ($license
    ->isConfigurable()) {
    $license
      ->formSubmit($entity_form, $form_state);
  }
}