silverstripe-gridfieldexten.../code/GridFieldAddNewMultiClassHandler.php
2016-12-21 15:26:42 +13:00

24 lines
577 B
PHP

<?php
namespace SilverStripe\Forms\GridField;
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)
);
}
}
}