silverstripe-framework/tests/php/Forms/GridField/GridFieldConfigTest/MyActionMenuItemComponent.php
Aaron Carlino 31ad3cdaab
BUGFIX: Allow buttons to opt out of display (#8113)
* Allow buttons to opt out of display

* Linting

* Remove redundant function call

* Add test for group delete action

* Add menu group check and test for delete action

* Fix linting
2018-06-06 21:14:29 +12:00

23 lines
610 B
PHP

<?php
namespace SilverStripe\Forms\Tests\GridField\GridFieldConfigTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\GridField\GridField_ActionMenuItem;
use SilverStripe\Forms\GridField\GridFieldEditButton;
class MyActionMenuItemComponent extends GridFieldEditButton implements TestOnly
{
protected $shouldDisplay;
public function __construct($shouldDisplay = true)
{
$this->shouldDisplay = $shouldDisplay;
}
public function getGroup($gridField, $record, $columnName)
{
return $this->shouldDisplay ? GridField_ActionMenuItem::DEFAULT_GROUP : null;
}
}