├── _config.php
├── CONTRIBUTING.md
├── _config
└── config.yml
├── CHANGELOG.md
├── .editorconfig
├── phpunit.xml.dist
├── .scrutinizer.yml
├── phpcs.xml.dist
├── composer.json
├── .travis.yml
├── README.md
├── LICENSE.md
└── src
└── ORM
└── ProductPageLegacy.php
/_config.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | tests
4 |
5 |
6 |
7 |
8 | src/
9 |
10 | tests/
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/.scrutinizer.yml:
--------------------------------------------------------------------------------
1 | inherit: true
2 |
3 | #Copied from https://www.adayinthelifeof.nl/2013/11/20/external-code-coverage-with-travis-scrutinizer/
4 | tools:
5 | external_code_coverage:
6 | timeout: 600
7 | php_code_sniffer:
8 | config:
9 | standard: PSR2
10 | php_cs_fixer:
11 | extensions:
12 | # Default:
13 | - php
14 | fixers: []
15 | enabled: false
16 | filter:
17 | paths: [tests/*,src/*]
18 | excluded_paths: []
19 | coding_style:
20 | php:
21 | indentation:
22 | general:
23 | use_tabs: false
24 |
25 | checks:
26 | php:
27 | code_rating: true
28 | duplication: true
29 |
30 | build:
31 | nodes:
32 | analysis:
33 | tests:
34 | override: [php-scrutinizer-run]
35 |
36 | filter:
37 | paths: [tests/*,src/*]
38 |
--------------------------------------------------------------------------------
/phpcs.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 | Coding standard for SilverStripe 4.x
4 |
5 |
6 | */vendor/*
7 | */thirdparty/*
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "dynamic/foxystripe-legacy-fields",
3 | "description": "Legacy fields from pre-4 versions of FoxyStripe for upgrades.",
4 | "authors": [
5 | {
6 | "name": "Dynamic",
7 | "email": "dev@dynamicagency.com",
8 | "homepage": "http://www.dynamicagency.com"
9 | }
10 | ],
11 | "keywords": [
12 | "silverstripe", "ecommerce", "foxystripe"
13 | ],
14 | "type": "silverstripe-vendormodule",
15 | "license": "BSD-3-Clause",
16 | "require": {
17 | "dynamic/foxystripe": "^4@dev",
18 | "silverstripe/recipe-cms": "^1@dev || ^4@dev",
19 | "silverstripe/vendor-plugin": "^1@dev"
20 | },
21 | "require-dev": {
22 | "phpunit/PHPUnit": "^5.7",
23 | "squizlabs/php_codesniffer": "*"
24 | },
25 | "config": {
26 | "process-timeout": 600
27 | },
28 | "autoload": {
29 | "psr-4": {
30 | "Dynamic\\FoxyStripe\\": "src/",
31 | "Dynamic\\FoxyStrpe\\Test\\": "tests/"
32 | }
33 | },
34 | "minimum-stability": "dev",
35 | "prefer-stable": true,
36 | "extra": {
37 | "branch-alias": {
38 | "dev-master": "1.0.x-dev"
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: php
2 |
3 | env:
4 | global:
5 | - COMPOSER_ROOT_VERSION=4.0.x-dev
6 | - CODECOV_TOKEN=
7 | - SCRUT_TOKEN=
8 |
9 | matrix:
10 | include:
11 | - php: 7.0
12 | env: DB=MYSQL PHPUNIT_TEST=1 PHPCS_TEST=1
13 | - php: 7.1
14 | env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
15 | - php: 5.6
16 | env: DB=MYSQL PHPUNIT_TEST=1
17 |
18 | before_script:
19 | # Init PHP
20 | - phpenv rehash
21 | - phpenv config-rm xdebug.ini
22 | - echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
23 |
24 | # Install composer dependencies
25 | - composer require --prefer-dist --no-update silverstripe-themes/simple:~3.2
26 | - composer update --no-suggest --prefer-dist
27 |
28 | script:
29 | - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
30 | - if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml && wget https://scrutinizer-ci.com/ocular.phar; fi
31 | - if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs src/ tests/; fi
32 |
33 | after_success:
34 | - if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml -t $CODECOV_TOKEN && travis_retry php ocular.phar code-coverage:upload --format=php-clover --access-token=$SCRUT_TOKEN coverage.xml; fi
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Foxystripe Legacy Fields
2 |
3 | Legacy fields from pre-4 versions of FoxyStripe for upgrades.
4 |
5 | [](https://travis-ci.com/dynamic/foxystripe-legacy-fields)
6 | [](https://scrutinizer-ci.com/g/dynamic/foxystripe-legacy-fields/?branch=master)
7 | [](https://scrutinizer-ci.com/g/dynamic/foxystripe-legacy-fields/?branch=master)
8 | [](https://scrutinizer-ci.com/g/dynamic/foxystripe-legacy-fields/build-status/master)
9 | [](https://codecov.io/gh/dynamic/foxystripe-legacy-fields)
10 |
11 | ## Requirements
12 |
13 | - SilverStripe 4.x
14 | - FoxyStripe 4.x
15 |
16 | ## Installation
17 |
18 | `composer require dynamic/foxystripe-legacy-fields`
19 |
20 | ## Example usage
21 |
22 | You use foxystripe-legacy-fields like this.
23 |
24 | ## Documentation
25 |
26 | See the [docs/en](docs/en/index.md) folder.
27 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2018, Dynamic
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 |
6 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 |
8 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 |
10 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13 |
--------------------------------------------------------------------------------
/src/ORM/ProductPageLegacy.php:
--------------------------------------------------------------------------------
1 | 'Boolean',
23 | ];
24 |
25 | /**
26 | * @var array
27 | */
28 | private static $has_one = [
29 | 'PreviewImage' => Image::class,
30 | ];
31 |
32 | /**
33 | * @var array
34 | */
35 | private static $has_many = [
36 | 'ProductImages' => ProductImage::class,
37 | ];
38 |
39 | /**
40 | * @var array
41 | */
42 | private static $searchable_fields = [
43 | 'Featured',
44 | ];
45 |
46 | /**
47 | * @param bool $includerelations
48 | *
49 | * @return array
50 | */
51 | public function fieldLabels($includerelations = true)
52 | {
53 | $labels = parent::fieldLabels();
54 |
55 | $labels['Featured.Nice'] = _t('ProductPage.NiceLabel', 'Featured');
56 |
57 | return $labels;
58 | }
59 |
60 | /**
61 | * @param FieldList $fields
62 | */
63 | public function updateCMSFields(FieldList $fields)
64 | {
65 | // allow extensions of ProductPage to override the PreviewImage field description
66 | $previewDescription = ($this->owner->config()->get('customPreviewDescription')) ?
67 | $this->config()->get('customPreviewDescription') :
68 | _t(
69 | 'ProductPage.PreviewImageDescription',
70 | 'Image used throughout site to represent this product'
71 | );
72 |
73 | // Product Images gridfield
74 | $config = GridFieldConfig_RelationEditor::create();
75 | $config->addComponent(new GridFieldOrderableRows('SortOrder'));
76 | $prodImagesField = GridField::create(
77 | 'ProductImages',
78 | _t('ProductPage.ProductImages', 'Images'),
79 | $this->owner->ProductImages(),
80 | $config
81 | );
82 |
83 | // Images tab
84 | $fields->addFieldsToTab('Root.Images', [
85 | HeaderField::create('MainImageHD', _t('ProductPage.MainImageHD', 'Product Image'), 2),
86 | UploadField::create('PreviewImage', '')
87 | ->setDescription($previewDescription)
88 | ->setFolderName('Uploads/Products')
89 | ->setAllowedExtensions(['jpg', 'jpeg', 'gif', 'png']),
90 | HeaderField::create('ProductImagesHD', _t('ProductPage.ProductImagesHD', 'Product Image Gallery'), 2),
91 | $prodImagesField
92 | ->setDescription(_t(
93 | 'ProductPage.ProductImagesDescription',
94 | 'Additional Product Images, shown in gallery on Product page'
95 | )),
96 | ]);
97 |
98 | $fields->addFieldsToTab('Root.Details', [
99 | CheckboxField::create('Featured')
100 | ->setTitle(_t('ProductPage.Featured', 'Featured Product')),
101 | ]);
102 | }
103 | }
104 |
--------------------------------------------------------------------------------