// Stash bulk actions: the selection survives paging, sorting and reloads.
$orders = GridFieldConfig_ToolkitBase::create(25)
->withStashBulk(
new DeleteBulkAction(),
new SetFieldBulkAction('archive', 'Archive', 'Status', 'archived'),
new CallbackBulkAction('mail', 'Send reminder', fn (Order $o) => $o->sendReminder()),
)
->withMasterSelect('OrderItems') // master: row click filters the slave
->withTransferSource() // rows can be dragged to another grid
->withViewStatePersister(); // remember sort / filter / page
$items = GridFieldConfig_ToolkitBase::create(25)
->withLinkedFilter('OrderID', emptyUntilSelected: true, masterLabel: 'Orders')
->withTransferTarget(['Orders'], function (DataObject $item, GridField $target, string $mode): void {
$item->OrderID = /* the order this grid belongs to */;
});
$config = GridFieldConfig_ToolkitBase::create(25)
->withColumnManager(locked: ['Title'], defaultHidden: ['CreatedAt'])
->withHeaderHelp(['Status' => _t('Order.STATUS_HELP', 'Where the order is in its life cycle')])
->withTranslationStatus() // Fluent, when installed; or pass a TranslationStatusProviderInterface
->withNestedRelation('Items', 'Items') // "Items (3)" button -> modal with the record's Items tab
->withViewStatePersister(); // also remembers the chosen columns
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.