You are here

function redhen_engagement_form_redhen_note_form_alter in RedHen CRM 7

Implements hook_form_FORMP_ID_alter().

Inject engagement score elements into a note form.

File

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

Code

function redhen_engagement_form_redhen_note_form_alter(&$form, &$form_state) {
  $note = $form_state['redhen_note'];
  if (isset($note->entity_type) && $note->entity_type != 'redhen_contact') {
    return;
  }
  $scores = redhen_engagement_get_scores();
  $options = array(
    '' => t('-- Select --'),
  );
  foreach ($scores as $score) {
    $options[$score->name] = $score->label;
  }
  $form['engagement_score'] = array(
    '#type' => 'select',
    '#title' => t('Engagement Score'),
    '#description' => t('The selected engagement score, if any, will be applied to the contact when creating this note.'),
    '#weight' => 99,
    '#options' => $options,
  );
  $form['#submit'][] = 'redhen_engagement_redhen_note_form_submit';
}