Total Complexity | 6 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class ProductExtension extends Extension |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * @return bool|String |
||
21 | */ |
||
22 | public function getRemoveLink() |
||
23 | { |
||
24 | $wishListPage = Config::inst()->get(ProductWishList::class, 'listing_page_class'); |
||
25 | /** @var \SilverStripe\CMS\Model\SiteTree $page */ |
||
26 | $page = $page = $wishListPage::get()->first(); |
||
|
|||
27 | |||
28 | if (!$page) { |
||
29 | return false; |
||
30 | } |
||
31 | |||
32 | if (!$this->canRemoveFromWishList()) { |
||
33 | return false; |
||
34 | } |
||
35 | |||
36 | return Controller::join_links( |
||
37 | $page->Link('remove'), |
||
38 | Controller::curr()->getRequest()->param('ID'), |
||
39 | $this->owner->ID |
||
40 | ); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return bool |
||
45 | */ |
||
46 | protected function canRemoveFromWishList() |
||
64 | } |
||
65 | } |
||
66 |