Skip to content

Commit

Permalink
Shift private static variables from yaml file to classes
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
AntonyThorpe committed Jun 13, 2024
1 parent a4a11e1 commit d1df253
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 13 deletions.
13 changes: 0 additions & 13 deletions _config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
5 changes: 5 additions & 0 deletions src/Cart/ShoppingCartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
5 changes: 5 additions & 0 deletions src/Extension/MemberExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
*/
class MemberExtension extends DataExtension
{
/**
* @config
*/
private static bool $login_joins_cart = true;

private static $has_many = [
'AddressBook' => Address::class,
];
Expand Down
30 changes: 30 additions & 0 deletions src/Extension/ProductImageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1df253

Please sign in to comment.