function engagements_content_register_content_type

7.x engagements.module engagements_content_register_content_type()
6.x engagements.module engagements_content_register_content_type()

For use with the content module. We will register our custom content type(s) for use with this module.

File

modules/engagements/engagements.module, line 2530
This is the primary module file for the engagements module.

Code

function engagements_content_register_content_type() 
 {

  $arr = array();

  $arr ['engagement'] = array(
    'title' => 'Engagement',
    'description' => 'This is a content type meant to track a students activities and communications in the system.',
    'settings' => array(
      'title' => array(
        'label' => t('Subject'),
        'weight' => 65,
      ),
    ),
  );


  // If we are in a popup (dialog)...
  if (@$_GET ['window_mode'] == 'popup') {
    // We want to make sure we redirect to our handler URL, which will close the dialog.
    $arr ['engagement']['settings']['#redirect'] = array(
      'path' => 'content-dialog-handle-after-save',
      'query' => '',
    );
  }




  $fields = array();


  $fields ['faculty_id'] = array(
    'type' => 'textfield',
    'label' => 'Faculty/Staff',
    'weight' => 5,
  );


  $fields ['from_sms_phone'] = array(
    'type' => 'select',
    'label' => t('From Text Phone Line:'),
    'hide_please_select' => TRUE,
    'options' => array(),
    'weight' => 7,
  );

  $fields ['student_id'] = array(
    'type' => 'textfield',
    'label' => 'Student',
    'weight' => 10,
  );


  $fields ['activity_datetime'] = array(
    'type' => 'datetime-local',
    'label' => 'Date/Time',
    'value' => 'now',
    'format_date' => 'short',
    'weight' => 12,
  );


  $fields ['engagement_type'] = array(
    'type' => 'select',
    'options' => array(
      'phone' => t('Phone Call'),
      'email' => t('Email'),
      'in_person' => t('In-Person Meeting'),
      'video_chat' => t('Video Chat'),
      'txt_msg' => t('Txt Message'),
      'social_media' => t('Social Media'),
      'other' => t('Other'),
    ),
    'label' => 'Type',
    'required' => TRUE,
    'hide_please_select' => TRUE,
    'weight' => 40,
  );

  $fields ['direction'] = array(
    'type' => 'select',
    'label' => t('Direction'),
    'required' => TRUE,
    'hide_please_select' => TRUE,
    'options' => array(
      'sent' => t("Sent"),
      'received' => t('Received'),
    ),
    'weight' => 50,
  );


  $fields ['phone_outcome'] = array(
    'type' => 'select',
    'label' => t('Phone Outcome'),
    'hide_please_select' => TRUE,
    'options' => array(
      'connected' => t("Connected"),
      'no_answer' => t('No Answer'),
      'voicemail' => t('Left Voicemail'),
      'busy' => t('Busy'),
      'wrong_number' => t('Wrong Number'),
    ),
    'weight' => 60,
  );


  $fields ['engagement_msg'] = array(
    'type' => 'textarea',
    'label' => t('Message'),
    'filter' => 'basic',
    'weight' => 70,
  );


  $fields ['attachment'] = array(
    'type' => 'file',
    'label' => t('Attach File(s)'),
    'weight' => 80,
    'limit' => 999, // essentially, infinite.
  );


  $fields ['visibility'] = array(
    'type' => 'radios',
    'label' => 'Visible to:',
    'options' => array('public' => 'Anyone (incl. student)', 'faculty' => 'Faculty/Staff only'),
    'weight' => 90,
  );


  $fields ['manual_entry'] = array(
    'type' => 'hidden',
    'value' => '',
  );

  $fields ['to_sms_phone'] = array(
    'type' => 'hidden',
    'value' => '',
  );



  $fields ['external_msg_id'] = array(
    'type' => 'hidden',
    'value' => '',
  );



  $arr ['engagement']['fields'] = $fields;



  return $arr;
}