You are here

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

View the pane to the customer @access protected

Return value

string

1 call to UCXF_Pane::checkout_view()
UCXF_AddressPane::checkout_view in class/UCXF_AddressPane.class.php
View the pane to the customer @access protected
1 method overrides UCXF_Pane::checkout_view()
UCXF_AddressPane::checkout_view in class/UCXF_AddressPane.class.php
View the pane to the customer @access protected

File

class/UCXF_Pane.class.php, line 139
Contains the UCXF_Pane class.

Class

UCXF_Pane
Base class for checkout panes and order panes implemented by Extra Fields Pane.

Code

protected function checkout_view() {
  $fields = $this
    ->loadFields();
  $contents = array();

  // Dynamically generate form elements
  $description = '';
  if (count($fields) > 0) {
    foreach ($fields as $field) {
      if ($field->enabled) {
        $generated_field = $field
          ->generate();
        $order_field_name = $this
          ->getFieldName($field);

        // Adding default value for every field except for hidden fields (php and constant)
        if (isset($this->order->{$order_field_name}) && $generated_field['#type'] !== 'hidden') {
          $generated_field['#default_value'] = $this->order->{$order_field_name};
        }

        // Add field
        $contents[$order_field_name] = $generated_field;

        // If the field happens to be a hidden field, display value if the user asks
        // This currently applies to value_type of php and constant ONLY
        if ($generated_field['#type'] == 'hidden' && $field
          ->may_display('checkout')) {
          $contents[$order_field_name . '_i'] = array(
            '#type' => 'item',
            '#title' => $field
              ->output('label'),
            '#value' => $generated_field['#value'],
          );
        }
      }
    }
  }
  return array(
    'description' => $description,
    'contents' => $contents,
    'theme' => 'uc_extra_fields_pane_checkout_pane',
  );
}