1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dynamic\Wishlist\Form; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use Dynamic\Wishlist\Model\ProductWishList; |
7
|
|
|
use SilverStripe\Control\Controller; |
8
|
|
|
use SilverStripe\Forms\DropdownField; |
9
|
|
|
use SilverStripe\Forms\FieldList; |
10
|
|
|
use SilverStripe\Forms\Form; |
11
|
|
|
use SilverStripe\Forms\FormAction; |
12
|
|
|
use SilverStripe\Forms\HiddenField; |
13
|
|
|
use SilverStripe\Security\Security; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Class AddToWishListForm |
17
|
|
|
* @package Dynamic\Wishlist\Form |
18
|
|
|
*/ |
19
|
|
|
class AddToWishListForm extends Form |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* AddToWishListForm constructor. |
23
|
|
|
* @param \SilverStripe\Control\Controller|\Dynamic\FoxyStripe\Page\ProductPage $controller |
|
|
|
|
24
|
|
|
* @param string $name |
25
|
|
|
*/ |
26
|
|
|
public function __construct(Controller $controller, $name = 'AddToWishListForm') |
27
|
|
|
{ |
28
|
|
|
$lists = ProductWishList::get()->filter([ |
29
|
|
|
'MemberID' => Security::getCurrentUser()->ID, |
30
|
|
|
]); |
31
|
|
|
$this->extend('updateWishLists', $lists); |
32
|
|
|
|
33
|
|
|
$fields = FieldList::create( |
34
|
|
|
HiddenField::create('ProductID', 'ProductID', $controller->ID), |
35
|
|
|
DropdownField::create('List', 'Wish List', $lists->map('ID', 'Title')) |
36
|
|
|
); |
37
|
|
|
$this->extend('updateFields', $fields); |
38
|
|
|
|
39
|
|
|
$actions = FieldList::create( |
40
|
|
|
FormAction::create('addToWishList')->setTitle('Add To List') |
41
|
|
|
); |
42
|
|
|
$this->extend('updateActions', $actions); |
43
|
|
|
|
44
|
|
|
parent::__construct($controller, $name, $fields, $actions); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths