From what I've read in the past few days, Rules will gather all information it needs from hook_entity_info. I still can't get my custom entity to appear in the data selector to make things work though. Here is my implementation of hook_entity_info:

function badge_entity_info() {                                                     
  $info = array();                                                                 

  $info['badge'] = array(                                                          
    'label' => t('Badge'),                                                         
    'base table' => 'badge',                                                       
    'class' => 'DrupalDefaultEntity',                                              
    'controller class' => 'DrupalDefaultEntityController',                         
    'entity keys' => array(                                                        
      'id' => 'bid',                                                               
      'label' => 'name',                                                           
    'module' => 'badge',                                                           
    'access callback' => 'badge_access',                                           
    'admin ui' => array(                                                           
      'path' => 'admin/structure/badge',                                           
      'file' => 'badge.admin.inc',                                                 
    'uri callback' => 'badge_uri',                                                 

  return $info;                                                                    

Everything else is working perfectly, I just need to understand how to make Rules recognize my custom entity.

1 Answer 1


Individual rules can have a type associated with them. Most rules work with Nodes but an Entity is 1 object up in the type hierarchy of Drupal. therefore rule(s) defined with the Rules module must be made aware that they are compatible with your custom entity type.

You would do this with an alter hook for Rules, or providing property information for your Entity: I can't set a data value using rule on a custom entity

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.