From d1df2538c9bfa99cfc1046d109db17f82b94b952 Mon Sep 17 00:00:00 2001 From: Antony Thorpe <1023740+AntonyThorpe@users.noreply.github.com> Date: Thu, 13 Jun 2024 18:37:44 +1200 Subject: [PATCH] Shift private static variables from yaml file to classes Remove private static variables from config.yml & add them to ProductImageExtension & MemberExtension classes Add missing private static disable_security_token to ShoppingCartController class Remove OrderProcessor.bcc_receipt_to_admin from config.yml (it is not used) --- _config/config.yml | 13 ----------- src/Cart/ShoppingCartController.php | 5 +++++ src/Extension/MemberExtension.php | 5 +++++ src/Extension/ProductImageExtension.php | 30 +++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/_config/config.yml b/_config/config.yml index 349229018..1f18cd39e 100644 --- a/_config/config.yml +++ b/_config/config.yml @@ -2,19 +2,6 @@ Name: silvershop-config After: framework/routes#coreroutes --- - -SilverStripe\Security\Member: - login_joins_cart: true - -SilverShop\Extension\ProductImageExtension: - thumbnail_width: 140 - thumbnail_height: 100 - content_image_width: 200 - large_image_width: 600 - -SilverShop\Checkout\OrderProcessor: - bcc_receipt_to_admin: true - SilverStripe\Admin\LeftAndMain: extra_requirements_css: - 'silvershop/core: client/dist/css/shopcms.css' diff --git a/src/Cart/ShoppingCartController.php b/src/Cart/ShoppingCartController.php index d65c8448e..ae63af29d 100644 --- a/src/Cart/ShoppingCartController.php +++ b/src/Cart/ShoppingCartController.php @@ -31,6 +31,11 @@ class ShoppingCartController extends Controller { private static $url_segment = 'shoppingcart'; + /** + * @config + */ + private static string $disable_security_token = ''; + /** * Whether or not this controller redirects to the cart-page whenever an item was added * diff --git a/src/Extension/MemberExtension.php b/src/Extension/MemberExtension.php index c4ec26a9e..5bce577a5 100644 --- a/src/Extension/MemberExtension.php +++ b/src/Extension/MemberExtension.php @@ -18,6 +18,11 @@ */ class MemberExtension extends DataExtension { + /** + * @config + */ + private static bool $login_joins_cart = true; + private static $has_many = [ 'AddressBook' => Address::class, ]; diff --git a/src/Extension/ProductImageExtension.php b/src/Extension/ProductImageExtension.php index 0c3ffbc19..0ac3c6a38 100644 --- a/src/Extension/ProductImageExtension.php +++ b/src/Extension/ProductImageExtension.php @@ -20,6 +20,36 @@ class ProductImageExtension extends DataExtension */ protected $owner; + /** + * @config + */ + private static int $thumbnail_width = 140; + + /** + * @config + */ + private static int $thumbnail_height = 100; + + /** + * @config + */ + private static int $content_image_width = 200; + + /** + * @config + */ + private static int $content_image_height = 0; + + /** + * @config + */ + private static int $large_image_width = 600; + + /** + * @config + */ + private static int $large_image_height = 0; + /** * @param bool $upscale [optional] * @return Image