|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SilverStripe\Registry\Tests\Stub; |
|
4
|
|
|
|
|
5
|
|
|
use SilverStripe\Dev\TestOnly; |
|
6
|
|
|
use SilverStripe\Forms\FieldList; |
|
7
|
|
|
use SilverStripe\Forms\TextField; |
|
8
|
|
|
use SilverStripe\ORM\DataObject; |
|
9
|
|
|
use Silverstripe\Control\Controller; |
|
10
|
|
|
use SilverStripe\Registry\RegistryDataInterface; |
|
11
|
|
|
use SilverStripe\Registry\Tests\Stub\RegistryPageTestPage; |
|
12
|
|
|
|
|
13
|
|
|
class RegistryPageTestContactExtra extends DataObject implements RegistryDataInterface, TestOnly |
|
14
|
|
|
{ |
|
15
|
|
|
private static $table_name = 'RegistryPageTestContactExtra'; |
|
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
private static $use_link = true; |
|
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
private static $db = [ |
|
|
|
|
|
|
20
|
|
|
'FirstName' => 'Varchar(50)', |
|
21
|
|
|
'Surname' => 'Varchar(50)', |
|
22
|
|
|
]; |
|
23
|
|
|
|
|
24
|
|
|
private static $has_one = [ |
|
|
|
|
|
|
25
|
|
|
'RegistryPage' => RegistryPageTestPage::class |
|
26
|
|
|
]; |
|
27
|
|
|
|
|
28
|
|
|
private static $summary_fields = [ |
|
|
|
|
|
|
29
|
|
|
'FirstName' => 'First name', |
|
30
|
|
|
'Surname' => 'Surname', |
|
31
|
|
|
'RegistryPage.Title' => 'Registry Page', |
|
32
|
|
|
'StaticReference' => 'Other' |
|
33
|
|
|
]; |
|
34
|
|
|
|
|
35
|
|
|
private static $searchable_fields = [ |
|
|
|
|
|
|
36
|
|
|
'FirstName', |
|
37
|
|
|
'Surname', |
|
38
|
|
|
'RegistryPageID' |
|
39
|
|
|
]; |
|
40
|
|
|
|
|
41
|
|
|
public function getSearchFields() |
|
42
|
|
|
{ |
|
43
|
|
|
return new FieldList( |
|
44
|
|
|
new TextField('FirstName', 'First name'), |
|
45
|
|
|
new TextField('Surname', 'Surname'), |
|
46
|
|
|
new TextField('RegistryPageID', 'Registry Page') |
|
47
|
|
|
); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function getStaticReference() |
|
51
|
|
|
{ |
|
52
|
|
|
return 'Static Reference'; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function Link($action = null) |
|
56
|
|
|
{ |
|
57
|
|
|
$page = RegistryPageTestPage::get()->filter('DataClass', RegistryPageTestContactExtra::class)->First(); |
|
58
|
|
|
return Controller::join_links($page->Link(), $action, $this->ID); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|