Completed
Push — master ( ce2dd0...10a6ac )
by Nicolaas
04:02
created

code/cms/ProductsAndGroupsModelAdmin.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
4
/**
5
 * @description: for the management of Product and Product Groups only
6
 *
7
 *
8
 * @authors: Nicolaas [at] Sunny Side Up .co.nz
9
 * @package: ecommerce
10
 * @sub-package: cms
11
 **/
12
class ProductsAndGroupsModelAdmin extends ModelAdminEcommerceBaseClass
13
{
14
    private static $menu_priority = 3.2;
15
16
    private static $url_segment = 'products';
17
18
    private static $menu_title = 'Products';
19
20
    private static $allowed_actions = array(
21
        'editinsitetree',
22
        'ItemEditForm',
23
    );
24
25
    /**
26
     * standard SS variable.
27
     *
28
     * @var string
29
     */
30
    private static $menu_icon = 'ecommerce/images/icons/product-file.gif';
31
32
33
    public function getEditForm($id = null, $fields = null)
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
34
    {
35
        $form = parent::getEditForm();
36
        if (is_subclass_of($this->modelClass, 'SiteTree') || $this->modelClass === 'SiteTree') {
37
            if ($gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass))) {
38
                if ($gridField instanceof GridField) {
39
                    $config = GridFieldEditOriginalPageConfig::create();
40
                    $exportButton = new GridFieldExportButton('buttons-before-left');
41
                    $exportButton->setExportColumns($this->getExportFields());
42
                    $config->addComponent($exportButton);
43
                    $gridField->setConfig($config);
44
                }
45
            }
46
        }
47
48
        return $form;
49
    }
50
51
52
}
53