You are here

function redhen_note_form in RedHen CRM 7

Return a form array for adding/editing a note.

_state

Parameters

$form:

RedhenContact|RedhenOrg $entity:

$entity_type:

stdClass $redhen_note:

Return value

array

1 string reference to 'redhen_note_form'
redhen_note_menu in modules/redhen_note/redhen_note.module
Implements hook_menu().

File

modules/redhen_note/includes/redhen_note.forms.inc, line 19
Form definition and handling for redhen notes.

Code

function redhen_note_form($form, &$form_state, $redhen_note, $entity = NULL) {

  // Check to ensure we have a note - we won't if form is being loaded via
  // the "add note" callback.
  if (!$redhen_note) {
    $redhen_note = entity_get_controller('redhen_note')
      ->create(array(
      'type' => 'redhen_note',
    ));
    $redhen_note->entity_type = $entity
      ->entityType();
  }
  $form_state['redhen_note'] = $redhen_note;
  $form_state['entity'] = $entity;
  field_attach_form('redhen_note', $redhen_note, $form, $form_state);
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Note'),
    '#weight' => 999,
  );
  return $form;
}