Source of file LoginCheckoutComponent.php
Size: 1,284 Bytes - Last Modified: 2021-12-23T10:05:16+00:00
/var/www/docs.ssmods.com/process/src/code/components/LoginCheckoutComponent.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | <?php /** * Milkyway Multimedia * LoginCheckoutComponent.php * * @package milkyway-multimedia/ss-shop-checkout-extras * @author Mellisa Hankins <mell@milkywaymultimedia.com.au> */ class LoginCheckoutComponent extends HtmlCheckoutComponent { public $link; public $type = 'alert-info'; public function __construct($name = '', $content = '', $link = '') { $name = $name ?: get_called_class(); parent::__construct($name, $content); } public function getFormFields(Order $order) { if (Member::currentUser() || $order->Member()->exists()) { return FieldList::create(); } $content = $this->content ?: _t('LoginCheckoutComponent.ALREADY_HAVE_AN_ACCOUNT?', 'Already have an account? <a class="checkout--login-link" href="{{ link }}">Sign in here</a>'); $link = $this->link ?: singleton('Security')->Link('login'); return FieldList::create( FormMessageField::create('LoginMessage', str_replace('{{ link }}', $link, $content), $this->type) ); } public function validateData(Order $order, array $data) { } public function getData(Order $order) { return []; } public function setData(Order $order, array $data) { } } |