You are here

function paypal_donate_view in Paypal Donation 7

This function is called with every node event. In this case we use this function to render the Paypal form on the user side of the website (So on watching the content). It will precent the Paypal button for users to donate money to the website.

@since 1.0

File

./paypal_donate.module, line 107

Code

function paypal_donate_view(&$node, $view_mode) {
  if (user_access('access content')) {
    if ($node->type == 'paypal_donate') {
      foreach ($node as $delta => $item) {
        if (is_array($item)) {
          if (isset($item['und'])) {
            $array = current($item['und']);
            if (isset($array['value'])) {
              $node->fields[$delta] = $array['value'];
              unset($node->{$delta});
            }
          }
        }
      }
      if (isset($node->fields['body']) == false) {
        $node->fields['body'] = '';
      }
      $node->content['paypal_donate_view_paypalform'] = array(
        '#markup' => paypal_donate_view_paypalform($node, $view_mode),
      );
    }
  }
  return $node;
}