Source of file GiftVoucherProductController.php
Size: 0,983 Bytes - Last Modified: 2021-12-24T06:35:13+00:00
/var/www/docs.ssmods.com/process/src/src/Page/GiftVoucherProductController.php
1234567891011121314151617181920212223242526272829303132333435363738394041 | <?php namespace SilverShop\Discounts\Page; use SilverShop\Discounts\Form\GiftVoucherFormValidator; use SilverShop\Page\ProductController; use SilverStripe\Forms\CurrencyField; class GiftVoucherProductController extends ProductController { private static $allowed_actions = [ 'Form' ]; public function Form() { $form = parent::Form(); if ($this->VariableAmount) { $form->setSaveableFields( [ 'UnitPrice' ] ); $form->Fields()->push( $giftamount = CurrencyField::create('UnitPrice', _t('GiftVoucherProduct.Amount', 'Amount'), $this->BasePrice) ); $giftamount->setForm($form); } $form->setValidator( $validator = new GiftVoucherFormValidator( [ 'Quantity', 'UnitPrice' ] ) ); return $form; } } |