Last active
June 25, 2024 00:04
-
-
Save GuySartorelli/1d3516714308685b3dfa84e8f9322de3 to your computer and use it in GitHub Desktop.
A really basic example of adding an action to a gridfield in Silverstripe CMS 4's SecurityAdmin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SilverStripe\Admin\SecurityAdmin: | |
extensions: | |
- App\Extensions\MyExtension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Extensions; | |
use App\GridField\Button; | |
use SilverStripe\Core\Extension; | |
use SilverStripe\Forms\Form; | |
use SilverStripe\Forms\GridField\GridField; | |
class MyExtension extends Extension | |
{ | |
public function updateEditForm(Form $form) | |
{ | |
/** @var GridField $membersGridField */ | |
$membersGridField = $form->Fields()->dataFieldByName('Members'); | |
$membersGridField->getConfig()->addComponent(new Button()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment