Completed
Push — master ( 824833...660d11 )
by
unknown
14s
created

code/DMSDocumentCartAdmin.php (3 issues)

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
class DMSDocumentCartAdmin extends ModelAdmin
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
    private static $managed_models = array(
6
        'DMSDocumentCartSubmission'
7
    );
8
9
    private static $url_segment = 'cart';
0 ignored issues
show
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...
10
    private static $menu_title = 'Document Cart';
0 ignored issues
show
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...
11
12
    /**
13
     * Remove ability to add new items in these grid fields
14
     *
15
     * @return CMSForm
16
     */
17
    public function getEditForm($id = null, $fields = null)
18
    {
19
        /** @var CMSForm $form */
20
        $form = parent::getEditForm($id, $fields);
21
22
        // See parent class
23
        $gridFieldName = $this->sanitiseClassName($this->modelClass);
24
25
        $gridFieldConfig = $form->Fields()->fieldByName($gridFieldName)->getConfig();
26
        $gridFieldConfig->removeComponentsByType('GridFieldAddNewButton');
27
28
        return $form;
29
    }
30
}
31