OrderActionsForm::__construct PHP Method

__construct() public method

public __construct ( $controller, $name, Order $order )
$order Order
    public function __construct($controller, $name, Order $order)
    {
        $this->order = $order;
        $fields = FieldList::create(HiddenField::create('OrderID', '', $order->ID));
        $actions = FieldList::create();
        //payment
        if (self::config()->allow_paying && $order->canPay()) {
            $gateways = GatewayInfo::getSupportedGateways();
            //remove manual gateways
            foreach ($gateways as $gateway => $gatewayname) {
                if (GatewayInfo::isManual($gateway)) {
                    unset($gateways[$gateway]);
                }
            }
            if (!empty($gateways)) {
                $fields->push(HeaderField::create("MakePaymentHeader", _t("OrderActionsForm.MakePayment", "Make Payment")));
                $outstandingfield = Currency::create();
                $outstandingfield->setValue($order->TotalOutstanding(true));
                $fields->push(LiteralField::create("Outstanding", _t('Order.OutstandingWithAmount', 'Outstanding: {Amount}', '', array('Amount' => $outstandingfield->Nice()))));
                $fields->push(OptionsetField::create('PaymentMethod', _t("OrderActionsForm.PaymentMethod", "Payment Method"), $gateways, key($gateways)));
                if ($ccFields = $this->getCCFields($gateways)) {
                    if ($this->config()->include_jquery) {
                        Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.min.js');
                    }
                    Requirements::javascript(SHOP_DIR . '/javascript/OrderActionsForm.js');
                    $fields->push($ccFields);
                }
                $actions->push(FormAction::create('dopayment', _t('OrderActionsForm.PayOrder', 'Pay outstanding balance')));
            }
        }
        //cancelling
        if (self::config()->allow_cancelling && $order->canCancel()) {
            $actions->push(FormAction::create('docancel', _t('OrderActionsForm.CancelOrder', 'Cancel this order')));
        }
        parent::__construct($controller, $name, $fields, $actions, OrderActionsForm_Validator::create(array('PaymentMethod')));
        $this->extend("updateForm", $order);
    }