mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
5254b1865c
Used [silverstripe-upgrader](https://github.com/silverstripe/silverstripe-upgrader) to fix name-spacing for SilverStripe v4. I then alphabetically sorted the use declarations for readability. Fixes: https://github.com/silverstripe-australia/silverstripe-gridfieldextensions/issues/166.
22 lines
536 B
PHP
22 lines
536 B
PHP
<?php
|
|
|
|
use SilverStripe\Control\Controller;
|
|
use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest;
|
|
|
|
/**
|
|
* A custom grid field request handler that allows interacting with form fields when adding records.
|
|
*/
|
|
class GridFieldAddNewMultiClassHandler extends GridFieldDetailForm_ItemRequest {
|
|
|
|
public function Link($action = null) {
|
|
if($this->record->ID) {
|
|
return parent::Link($action);
|
|
} else {
|
|
return Controller::join_links(
|
|
$this->gridField->Link(), 'add-multi-class', get_class($this->record)
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|