Completed
Pull Request — master (#458)
by Roman
13:38
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
6
use SilverStripe\Control\Controller;
7
use SilverStripe\Core\Extension;
8
use SilverStripe\Forms\FieldList;
9
use SilverStripe\Forms\FormAction;
10
use SilverStripe\Forms\PopoverField;
11
12
/**
13
 * Extension that updates the Popover menu of `FileFormFactory`.
14
 * This extension will only be applied if the `campaign-admin` module is installed.
15
 * @package SilverStripe\AssetAdmin\Extensions
16
 */
17
class CampaignAdminExtension extends Extension
18
{
19
	/**
20
     * Update the Popover menu of `FileFormFactory` with the "Add to campaign" button.
21
     *
22
	 * @param FieldList $actions
23
	 * @param Controller $controller
24
	 * @param string $formName
25
	 * @param array $context
26
	 */
27
	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...
28
	{
29
	    if ($popoverField = $actions->fieldByName('PopoverActions')) {
30
	        $popoverField->unshift(FormAction::create(
31
                'addtocampaign',
32
                _t('SilverStripe\\AssetAdmin\\Controller\\AssetAdmin.ADDTOCAMPAIGN', 'Add to campaign')
33
            ));
34
        }
35
	}
36
}
37