function redhen_engagement_redhen_note_form_submit in RedHen CRM 7
Submit handler for redhen_engagement_form_redhen_note_form_alter().
Save the engagement score.
1 string reference to 'redhen_engagement_redhen_note_form_submit'
- redhen_engagement_form_redhen_note_form_alter in modules/
redhen_engagement/ redhen_engagement.module - Implements hook_form_FORMP_ID_alter().
File
- modules/
redhen_engagement/ redhen_engagement.module, line 371 - RedhenEngagement hook implementations and API
Code
function redhen_engagement_redhen_note_form_submit($form, $form_state) {
$score = $form_state['values']['engagement_score'];
if (!empty($score)) {
$note = $form_state['redhen_note'];
if (isset($form_state['entity'])) {
$entity = $form_state['entity'];
}
else {
$wrapper = entity_metadata_wrapper('redhen_note', $note);
$entity = $wrapper->entity
->value();
}
$redhen_engagement = redhen_engagement_create($score, $entity
->internalIdentifier(), t('Created when saving note @note', array(
'@note' => $note
->internalIdentifier(),
)), 'redhen_note', $note
->internalIdentifier());
redhen_engagement_save($redhen_engagement);
}
}