silverstripe /
silverstripe-elemental
| 1 | <?php |
||
| 2 | |||
| 3 | namespace DNADesign\Elemental\Tests\Src; |
||
| 4 | |||
| 5 | use DNADesign\Elemental\Models\BaseElement; |
||
| 6 | use SilverStripe\Dev\TestOnly; |
||
| 7 | use SilverStripe\Security\Permission; |
||
| 8 | |||
| 9 | class TestElement extends BaseElement implements TestOnly |
||
| 10 | { |
||
| 11 | private static $table_name = 'TestElement'; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 12 | |||
| 13 | private static $db = [ |
||
|
0 ignored issues
–
show
|
|||
| 14 | 'TestValue' => 'Text', |
||
| 15 | ]; |
||
| 16 | |||
| 17 | private static $controller_class = TestElementController::class; |
||
|
0 ignored issues
–
show
|
|||
| 18 | |||
| 19 | public function getType() |
||
| 20 | { |
||
| 21 | return 'A test element'; |
||
| 22 | } |
||
| 23 | |||
| 24 | public function canView($member = null) |
||
| 25 | { |
||
| 26 | $check = Permission::checkMember($member, 'ADMIN'); |
||
| 27 | if ($check !== null) { |
||
|
0 ignored issues
–
show
|
|||
| 28 | return $check; |
||
| 29 | } |
||
| 30 | return parent::canView($member); |
||
| 31 | } |
||
| 32 | } |
||
| 33 |