Completed
Push — master ( cb6000...0f63fa )
by Sam
02:23
created

FolderFormFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFormActions() 0 13 3
1
<?php
2
3
namespace SilverStripe\AssetAdmin\Forms;
4
5
use SilverStripe\Control\Controller;
6
use SilverStripe\Forms\FieldList;
7
8
class FolderFormFactory extends AssetFormFactory
9
{
10
11
    protected function getFormActions(Controller $controller, $name, $context = [])
12
    {
13
        $record = isset($context['Record']) ? $context['Record'] : null;
14
15
        // Add delete action as top level button before extensions are triggered
16
        $this->beforeExtending('updateFormActions', function (FieldList $actions) use ($record) {
17
            if ($deleteAction = $this->getDeleteAction($record)) {
18
                $actions->push($deleteAction);
19
            }
20
        });
21
22
        return parent::getFormActions($controller, $name, $context);
23
    }
24
}
25