You are here

function inline_entity_form_trigger_submit in Inline Entity Form 7

Button #submit callback: Triggers submission of entity forms.

Parameters

$form: The complete parent form.

$form_state: The form state of the parent form.

3 string references to 'inline_entity_form_trigger_submit'
inline_entity_form_entity_form in ./inline_entity_form.module
Wraps and returns the entity form provided by the passed-in controller.
inline_entity_form_form_alter in ./inline_entity_form.module
Implements hook_form_alter().
inline_entity_form_reference_form in ./inline_entity_form.module
Provides the form for adding existing entities through an autocomplete field.

File

./inline_entity_form.module, line 1267
Provides a widget for inline management (creation, modification, removal) of referenced entities. The primary use case is the parent -> children one (for example, order -> line items), where the child entities are never managed outside the…

Code

function inline_entity_form_trigger_submit($form, &$form_state) {
  if (!empty($form_state['triggering_element']['#ief_submit_all'])) {

    // The parent form was submitted, process all IEFs and their children.
    inline_entity_form_submit($form, $form_state);
  }
  else {

    // A specific entity form was submitted, process it and all of its children.
    $array_parents = $form_state['triggering_element']['#array_parents'];
    $array_parents = array_slice($array_parents, 0, -2);
    $element = drupal_array_get_nested_value($form, $array_parents);
    inline_entity_form_submit($element, $form_state);
  }
}