Background

At the moment, when child entities are saved or deleted during inline_entity_form_field_attach_submit() we can react with Rules by reacting against parent entity save OR child entity save.

Problem / Motivation

If I would like to do stuff with Rules, where I need to know both entities, there is not way to figure out parent entity from child entity save. In parent entity save, there are ways to figure it out, but find it very frustrating.

I could do all this in code by altering the controller and code it. But as I'm implementing most of logic through rules, I feel uncomfortable to make couple exceptions by coding just because I don't have sufficient events available in Rules.

Feature request / Proposal

To make this easy, I would like to request four new API hooks and Rules events in order to allow modules react on these critical event of pairing up child and parent entities.

  • Before saving inline entity
  • After saving inline entity
  • Before deleting inline entities
  • After deleting inline entities
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anybody’s picture

+1 for this feature request.

iMiksu’s picture

Status: Active » Needs review
FileSize
8.46 KB
8.42 KB

Here's an initial patches for dev and 1.5 versions.

I haven't tested this much yet, will test later more and provide potential fixes.

Chris Matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 4 year old patch in #2 does not apply to the latest inline_entity_form 7.x-1.x-dev and if still applicable needs a reroll.

Checking patch inline_entity_form.api.php...
Checking patch inline_entity_form.module...
Hunk #1 succeeded at 1540 (offset 51 lines).
error: while searching for:
      $need_reset = false;
      foreach ($values['entities'] as $item) {
        if ($item['needs_save']) {
          $controller->save($item['entity'], $context);
          $need_reset = true;
        }

        list($entity_id) = entity_extract_ids($entity_type, $item['entity']);

error: patch failed: inline_entity_form.module:1499
error: inline_entity_form.module: patch does not apply
Checking patch inline_entity_form.rules.inc...
error: inline_entity_form.rules.inc: No such file or directory