You are here

function heartbeat_entity_info in Heartbeat 7

Implement hook_entity_info().

File

./heartbeat.entity.inc, line 6

Code

function heartbeat_entity_info() {
  $return = array(
    'heartbeat_activity' => array(
      'label' => t('Heartbeat Activity Entity'),
      'controller class' => 'HeartbeatActivityController',
      'base table' => 'heartbeat_activity',
      'uri callback' => 'heartbeat_activity_uri',
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'uaid',
        'bundle' => 'message_id',
        'label' => 'message_id',
      ),
      'bundle keys' => array(
        'bundle' => 'message_id',
      ),
      'bundles' => array(),
      'view modes' => array(
        'full' => array(
          'label' => t('Full activity message'),
          'custom settings' => FALSE,
        ),
      ),
      'module' => 'heartbeat',
    ),
  );

  // Bundles must provide a human readable name so we can create help and error
  // messages, and the path to attach Field admin pages to.
  foreach (heartbeat_templates_names() as $name => $description) {
    $return['heartbeat_activity']['bundles'][$name] = array(
      'label' => $description,
    );
    if (module_exists('heartbeat_ui')) {
      $return['heartbeat_activity']['bundles'][$name]['admin'] = array(
        'path' => 'admin/structure/heartbeat/templates/list/%heartbeat_message_template',
        'real path' => 'admin/structure/heartbeat/templates/list/' . $name,
        'bundle argument' => 5,
        'access arguments' => array(
          'admin heartbeat templates',
        ),
      );
    }
  }
  $return['heartbeat_activity_template'] = array(
    'label' => t('Heartbeat activity entity type'),
    'controller class' => 'HeartbeatTemplateController',
    'base table' => 'heartbeat_messages',
    'entity keys' => array(
      'id' => 'hid',
      'label' => 'message_id',
    ),
    'fieldable' => FALSE,
  );
  return $return;
}