You are here

function theme_invite_form in Invite 5.2

Same name and namespace in other branches
  1. 5 invite.module \theme_invite_form()
  2. 6.2 invite.module \theme_invite_form()

Theme function for the invite form.

File

./invite.module, line 813
Allows your users to send and track invitations to join your site.

Code

function theme_invite_form($form) {
  $output = '';
  $op = $form['#parameters'][1];
  if ($op == 'page') {

    // Show form elements.
    $output .= drupal_render($form['remaining_invites_markup']);
    $output .= drupal_render($form['remaining_invites']);
    $output .= drupal_render($form['from']);
    if (isset($form['email_markup'])) {
      $output .= drupal_render($form['email_markup']);
    }
    $output .= drupal_render($form['email']);
    $output .= drupal_render($form['subject']);

    // Show complete invitation message.
    $output .= drupal_render($form['body']);
    $output .= '<div class="invite-message"><div class="opening">';

    // Prepare invitation message.
    $message_form = "</p></div>\n" . drupal_render($form['message']) . "\n" . '<div class="closing"><p>';
    $body = _filter_autop(t(_invite_get_mail_template()));

    // Perform token replacement on message body.
    $types = _invite_token_types(array(
      'data' => array(
        'message' => $message_form,
      ),
    ));
    $output .= token_replace_multiple($body, $types);
    $output .= "</div></div>\n";
  }

  // Render all missing form elements.
  $output .= drupal_render($form);
  return $output;
}