You are here

function _webform_render_paypal in Webform Paypal 7.2

Same name and namespace in other branches
  1. 7 webform_paypal.module \_webform_render_paypal()

Render a Webform component to be part of a form. This function allows you to define how your webform component will be rendered when a "regular" user is filling it out.

File

./webform_paypal.module, line 142

Code

function _webform_render_paypal($component, $value = NULL, $filter = TRUE) {

  // adjust the form element based on where the user is
  $item = menu_get_item();
  if ($value['status'] == 'paid') {
    $value = 1;
  }
  else {
    $value = 0;
  }
  if (strpos($item['path'], 'edit') && user_access('update payment status')) {
    $element = array(
      '#title' => 'Mark Status as Paid',
      '#type' => 'checkbox',
      '#theme_wrappers' => array(
        'webform_element',
      ),
      '#webform_component' => $component,
      '#default_value' => $value,
    );
  }
  else {
    $element = array(
      '#type' => 'hidden',
      '#default_value' => $component['value'],
      '#theme_wrappers' => array(
        'webform_element',
      ),
      '#webform_component' => $component,
    );
  }
  return $element;
}