Hi,

Now, if you do any operation on referenced entity through IEF widget, it gets saved only after Parent entity is saved.
Is there a way to force updating/saving entity even if parent entity is not yet submited?

I've looked at calling eck__entity__form_submit but without luck.

Thx

Comments

nbchip created an issue. See original summary.

nbchip’s picture

Status: Active » Closed (fixed)

Found Solution,

Extended EntityInlineEntityFormController (or better ECK) and in overridden method entityFormSubmit added entity_save.

To use new controller u need to set it in hook_entity_info_alter for your entity.

emmanvazz’s picture

For those that are looking to save nodes you can also use the node_save function, add that at the end of the entityFormSubmit override.

public function entityFormSubmit(&$entity_form, &$form_state) {
    parent::entityFormSubmit($entity_form, $form_state);

    node_submit($entity_form['#entity']);
    $child_form_state = form_state_defaults();
    $child_form_state['values'] = drupal_array_get_nested_value($form_state['values'], $entity_form['#parents']);
    foreach (module_implements('node_submit') as $module) {
      $function = $module . '_node_submit';
      $function($entity_form['#entity'], $entity_form, $child_form_state);
    }
    node_save($entity_form['#entity']);
  }