Hey Ted,

This looks like it'd be a great way to get Rules-based validation into non-Entityform things, so I'm hoping we can sort this out. I'm trying to use Entity Rules with Field Collection items and it doesn't appear to work. Basically, I've found three (potentially separate) issues:

1) The Validation Rules tab doesn't appear when "Field collection item" is the only Enabled Type selected under the Settings tab.

2) If you can get to the Validation Rules and create one for a Field collection item, you still don't get a tab for it on Field collection item fields' respective edit pages.

3) If instead of a Validation Rule, you make a Create Rule, you can enable it on the Field collection item field. Unfortunately, I don't think it actually applies correctly. I set up my rule where if it satisfies my Conditions (which it does), it will show a message and set the Continue value to False. The message shows, but the new Field Collection item still gets added. Am I just missing something?

I can split this into separate issues if you'd like, but I thought I'd start like this since the first two may provide some explanation for the third part.

Comments

tedbow’s picture

For #1. Validation and Form Access don't work with all entity types. Basically I have to know the form_id for the entity add/edit. There is no automatic way to tell this.

Checkout "entity_rules_entity_rules_info" I was going to set the form_ids form some popular contrib modules, field collection included.

For #2. So I guess I need to check which Entity types support which Entity Rule type in this spot too. So you won't be able to select "Field Collection" here(until it is supported).

For #3 the continue is actually to set whether the other Rules will fire.

kyleoliveira’s picture

Excellent, thanks! I'll take a look at the new dev version shortly and see if it does the trick.

Update:
The extra text does help to clarify what the variables actually do. What should we look for to get the Entity Rule types working for contributed modules?