You are here

protected function UCXF_AddressPane::checkout_view in Extra Fields Checkout Pane 6.2

View the pane to the customer @access protected

Return value

string

Overrides UCXF_Pane::checkout_view

File

class/UCXF_AddressPane.class.php, line 45
Contains the UCXF_AddressPane class.

Class

UCXF_AddressPane
Class that deals with checkout panes and order panes especially for the address fields.

Code

protected function checkout_view() {
  $extra_pane = parent::checkout_view();

  // Get contents from original pane
  $original_pane = $this
    ->getOriginalPane('view');

  // Loop through all extra address fields
  foreach ($extra_pane['contents'] as $fieldname => $field) {

    // Adding default value for every field except for hidden fields (php and constant)
    if ($field['#type'] == 'hidden') {

      // If the field is a hidden field, the field will be added to the array 'hidden_fields',
      // because else it will be displayed as if it was a 'normal' field.
      $extra_pane['contents']['hidden_fields'][$fieldname] = $field;
      unset($extra_pane['contents'][$fieldname]);
    }
    if ($field['#type'] == 'item') {

      // theme_address_pane() in uc_cart/uc_cart_checkout_pane.inc expects that every field
      // has an #id property, so we set a dummy value here to prevent a PHP notice.
      $extra_pane['contents'][$fieldname]['#id'] = NULL;
    }
  }

  // Merge contents
  $pane = $original_pane;
  $pane['contents'] = array_merge($original_pane['contents'], $extra_pane['contents']);
  return $pane;
}