Passed
Branch ss4 (364df2)
by Simon
01:53
created

SlackAdmin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2
1
<?php
2
3
namespace Firesphere\StripeSlack\Admin;
4
5
use Firesphere\StripeSlack\Actions\GridfieldInviteResendAction;
6
use Firesphere\StripeSlack\Model\SlackInvite;
7
use SilverStripe\Admin\ModelAdmin;
8
9
/**
10
 * Class SlackAdmin
11
 *
12
 */
13
class SlackAdmin extends ModelAdmin
14
{
15
    private static $managed_models = [
1 ignored issue
show
Unused Code introduced by
The property $managed_models is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
16
        SlackInvite::class
17
    ];
18
19
    private static $url_segment = 'SlackInvite';
1 ignored issue
show
Unused Code introduced by
The property $url_segment is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
20
21
    private static $menu_title = 'Slack Invites';
1 ignored issue
show
Unused Code introduced by
The property $menu_title is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
22
23
    private static $menu_icon = '/stripeslack/img/slack_logo.png';
1 ignored issue
show
Unused Code introduced by
The property $menu_icon is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
24
25
26
    public function getEditForm($id = null, $fields = null)
27
    {
28
        /** @var $this |Form $form */
29
        $form = parent::getEditForm($id, $fields);
30
        // Slightly pointless because it only manages 1 model, but ¯\_(ツ)_/¯
31
        if ($this->modelClass === 'SlackInvite') {
32
            $form->Fields()
33
                ->fieldByName('SlackInvite')
34
                ->getConfig()
35
                ->addComponent(
36
                    new GridfieldInviteResendAction()
37
                );
38
        }
39
40
        return $form;
41
    }
42
}
43