You are here

public function RedhenEngagementMetadataController::entityPropertyInfo in RedHen CRM 7

Override parent to define entity propery metadat for engagements.

Return value

array Associative array of entity properties.

Overrides EntityDefaultMetadataController::entityPropertyInfo

File

modules/redhen_engagement/lib/redhen_engagement.metadata.inc, line 21

Class

RedhenEngagementMetadataController
Controls metadata for Redhen Engagement Scores.

Code

public function entityPropertyInfo() {
  $info = parent::entityPropertyInfo();
  $properties =& $info[$this->type]['properties'];
  $properties['created'] = array(
    'label' => t("Created"),
    'description' => t("The date the note was created."),
    'type' => 'date',
    'schema field' => 'created',
    // RedHen specific attributes.
    'filter' => TRUE,
    'field_type' => 'textfield',
  );

  // Entities.
  $properties['entity'] = array(
    'label' => t("Source entity"),
    'type' => 'entity',
    'description' => t("The host entity."),
    'getter callback' => 'redhen_engagement_property_source_get',
    'setter callback' => 'entity_property_verbatim_set',
  );
  $properties['contact'] = array(
    'label' => t("Contact"),
    'type' => 'redhen_contact',
    'description' => t("The redhen_contact this engagement applies to."),
    'schema field' => 'contact_id',
    'setter callback' => 'entity_property_verbatim_set',
    'required' => TRUE,
  );
  $properties['author'] = array(
    'label' => t("Author"),
    'type' => 'user',
    'description' => t("The author of the note."),
    'schema field' => 'author_uid',
    'required' => TRUE,
  );
  $properties['engagement_score'] = array(
    'label' => t('Engagement score'),
    'type' => 'redhen_engagement_score',
    'schema field' => 'engagement_score',
    'description' => t('The engagement score.'),
    'options list' => 'redhen_engagement_score_options',
    'setter callback' => 'entity_property_verbatim_set',
    // RedHen specific attributes.
    'field_type' => 'select',
    'filter' => TRUE,
    'required' => TRUE,
  );
  return $info;
}