Completed
Pull Request — master (#168)
by Franco
02:39
created

code/cms/DMSGridFieldEditButton.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
class DMSGridFieldEditButton extends GridFieldEditButton
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
    /**
6
     * Overriding the parent method to change the template that the DMS add button will be rendered with
7
     *
8
     * @param GridField $gridField
9
     * @param DataObject $record
10
     * @param string $columnName
11
     * @return HTMLText
12
     */
13
    public function getColumnContent($gridField, $record, $columnName)
14
    {
15
        $data = new ArrayData(array(
16
            'Link' => Controller::join_links($gridField->Link('item'), $record->ID, 'edit')
17
        ));
18
        $template = $record->canEdit() ? 'GridFieldEditButton' : 'GridFieldViewButton';
19
        return $data->renderWith($template);
20
    }
21
}
22