Someone was looking for a condition similar to the node type one, only for entities types. I figured it wouldn't take me too long, so I gave it a shot. Attached below is a patch that adds this. Right now, it's slightly flawed though. It only works on fieldable entity forms because it uses hook_field_attach_form(). If anyone's got a better solution, I'm all ears.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wbobeirne’s picture

Status: Active » Needs work
FileSize
4.03 KB

Patch attached.

swim’s picture

Hey wboberine,

We recently required this functionality for targeting all entityforms. I applied the patch to 3.x-dev and all went smoothly. Thank you for uploading this patch!

Can we see this committed to the dev version in the near future?

Cheers,

swim’s picture

Issue summary: View changes
Status: Needs work » Needs review

Didn't notice the duplicate issue; this one was first in google results for me. Updated issue.

swim’s picture

rcodina’s picture

Status: Needs review » Reviewed & tested by the community

It also works for me on 7.x-3.3+1-dev. Thanks for this!

ron_s’s picture

Please review the new patch I added on the Generic entity support thread (https://www.drupal.org/node/1332364#comment-9843157). It extends the patch created by @DamienMcKenna to include functionality similar to node type.

Since it's based on hook_form_alter and hook_entity_view_alter, this should work for all types of entities in both view and edit modes. I've tested it with Entityform and Bean, and worked with both without issue.

I'd appreciate if others can test and see if there are any problems that need to be addressed. Thanks.

hass’s picture

Status: Reviewed & tested by the community » Closed (duplicate)