You are here

function redhen_engagement_create in RedHen CRM 7

Creates a new RedhenEngagement object.

Parameters

string $engagement_score_name: Machine name of an engagement score

int $contact_id: Contact id.

string $description: Engagement description.

string $entity_type: Optional source entity type.

null $entity_id: Optional source entity id.

Return value

RedhenEngagement New populated engagement enttiy.

2 calls to redhen_engagement_create()
redhen_engagement_redhen_note_form_submit in modules/redhen_engagement/redhen_engagement.module
Submit handler for redhen_engagement_form_redhen_note_form_alter().
redhen_engagement_rules_action_score_contact in modules/redhen_engagement/redhen_engagement.rules.inc
Helper function for saving a comment engagement score when the Rule action is triggered.

File

modules/redhen_engagement/redhen_engagement.module, line 273
RedhenEngagement hook implementations and API

Code

function redhen_engagement_create($engagement_score_name, $contact_id, $description, $entity_type = NULL, $entity_id = NULL, $author_uid = NULL) {
  if (!$author_uid) {
    global $user;
    $author_uid = $user->uid;
  }
  return new RedhenEngagement(array(
    'engagement_score' => $engagement_score_name,
    'contact_id' => $contact_id,
    'description' => $description,
    'entity_type' => $entity_type,
    'entity_id' => $entity_id,
    'author_uid' => $author_uid,
  ));
}