Total Complexity | 5 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 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 | if ($this->canRemoveFromWishList()) { |
||
26 | /** @var \SilverStripe\CMS\Model\SiteTree $page */ |
||
27 | if ($page = $wishListPage::get()->first()) { |
||
28 | return Controller::join_links( |
||
29 | $page->Link('remove'), |
||
30 | Controller::curr()->getRequest()->param('ID'), |
||
31 | $this->owner->ID |
||
32 | ); |
||
33 | } |
||
34 | } |
||
35 | |||
36 | return false; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return bool |
||
41 | */ |
||
42 | protected function canRemoveFromWishList() |
||
50 | } |
||
51 | } |
||
52 |