1 | <?php |
||
2 | |||
3 | namespace Dynamic\Foxy\Integrations\Extension; |
||
4 | |||
5 | use Dynamic\Foxy\Integrations\Model\FoxyIntegrationObject; |
||
6 | use SilverStripe\Forms\FieldList; |
||
7 | use SilverStripe\Forms\HeaderField; |
||
8 | use SilverStripe\Forms\LiteralField; |
||
9 | use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor; |
||
10 | use SilverStripe\Forms\GridField\GridFieldAddExistingAutocompleter; |
||
11 | use SilverStripe\Forms\GridField\GridField; |
||
12 | use SilverStripe\ORM\DataExtension; |
||
13 | |||
14 | class FoxyIntegrationsSetting extends DataExtension |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | private static $has_many = array( |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
20 | 'Integrations' => FoxyIntegrationObject::class |
||
21 | ); |
||
22 | |||
23 | /** |
||
24 | * @param FieldList $fields |
||
25 | */ |
||
26 | public function updateCMSFields(FieldList $fields) |
||
27 | { |
||
28 | if ($integrations = $fields->dataFieldByName('Integrations')) { |
||
29 | $fields->removeByName('Integrations'); |
||
30 | |||
31 | $config = $integrations->getConfig(); |
||
32 | $config |
||
33 | ->removeComponentsByType([ |
||
34 | GridFieldAddExistingAutocompleter::class |
||
35 | ]); |
||
36 | |||
37 | |||
38 | $fields->addFieldsToTab('Root.Integrations', array( |
||
39 | HeaderField::create('IntegrationsHeader', 'Foxy Integrations', 3), |
||
40 | LiteralField::create( |
||
41 | 'IntegrationsDescip', |
||
42 | '<p>Push your Foxy.io datafeed to additional URLs for processing. This allows your |
||
43 | datafeed to be used by additional applications, such as |
||
44 | <a href="http://foxytools.com/orderdesk/" target="_blank">OrderDesk</a>.</p>' |
||
45 | ), |
||
46 | $integrations |
||
47 | )); |
||
48 | } |
||
49 | } |
||
50 | } |
||
51 |