Completed
Pull Request — master (#458)
by Roman
06:58 queued 04:35
created

CampaignAdminExtension::updateFormActions()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 2
eloc 5
nc 2
nop 4
1
<?php
2
3
namespace SilverStripe\AssetAdmin\Extensions;
4
5
use SilverStripe\Control\Controller;
6
use SilverStripe\Core\Extension;
7
use SilverStripe\Forms\FieldList;
8
use SilverStripe\Forms\FormAction;
9
use SilverStripe\Forms\PopoverField;
10
11
/**
12
 * Extension that updates the Popover menu of `FileFormFactory`.
13
 * This extension will only be applied if the `campaign-admin` module is installed.
14
 * @package SilverStripe\AssetAdmin\Extensions
15
 */
16
class CampaignAdminExtension extends Extension
17
{
18
    /**
19
     * Update the Popover menu of `FileFormFactory` with the "Add to campaign" button.
20
     *
21
     * @param FieldList $actions
22
     * @param Controller $controller
23
     * @param string $formName
24
     * @param array $context
25
     */
26
    public function updateFormActions($actions, $controller, $formName, $context)
0 ignored issues
show
Unused Code introduced by
The parameter $controller is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $formName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $context is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
    {
28
        if ($popoverField = $actions->fieldByName('PopoverActions')) {
29
            $popoverField->unshift(FormAction::create(
30
                'addtocampaign',
31
                _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ADDTOCAMPAIGN', 'Add to campaign')
32
            ));
33
        }
34
    }
35
}
36