mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
Get current controller via curr() (removes pushCurrent issue)
This commit is contained in:
parent
52d95ae82c
commit
af8d20e93a
@ -16,6 +16,7 @@ use SilverStripe\Forms\GridField\GridField_URLHandler;
|
|||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\View\ArrayData;
|
use SilverStripe\View\ArrayData;
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\View\Requirements;
|
||||||
|
use SilverStripe\Control\Controller;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GridField component for editing attached models in bulk.
|
* GridField component for editing attached models in bulk.
|
||||||
@ -344,15 +345,13 @@ class BulkManager implements GridField_HTMLProvider, GridField_ColumnProvider, G
|
|||||||
*/
|
*/
|
||||||
public function handleBulkAction($gridField, $request)
|
public function handleBulkAction($gridField, $request)
|
||||||
{
|
{
|
||||||
$controller = $gridField->getForm()->getController();
|
$controller = Controller::curr();
|
||||||
|
|
||||||
$actionUrlSegment = $request->shift();
|
$actionUrlSegment = $request->shift();
|
||||||
$handlerClass = $this->config['actions'][$actionUrlSegment];
|
$handlerClass = $this->config['actions'][$actionUrlSegment];
|
||||||
|
|
||||||
$controller->pushCurrent();
|
$controller->pushCurrent();
|
||||||
$handler = Injector::inst()->create($handlerClass, $gridField, $this);
|
$handler = Injector::inst()->create($handlerClass, $gridField, $this);
|
||||||
if ($handler)
|
if ($handler) {
|
||||||
{
|
|
||||||
return $handler->handleRequest($request);
|
return $handler->handleRequest($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,17 +2,18 @@
|
|||||||
|
|
||||||
namespace Colymba\BulkUpload;
|
namespace Colymba\BulkUpload;
|
||||||
|
|
||||||
use Colymba\BulkUpload\BulkUploadHandler;
|
|
||||||
use Colymba\BulkUpload\BulkUploadField;
|
|
||||||
|
|
||||||
use SilverStripe\Core\Config\Config;
|
|
||||||
use SilverStripe\Dev\Deprecation;
|
|
||||||
use SilverStripe\Forms\FormAction;
|
|
||||||
use SilverStripe\Forms\GridField\GridField_HTMLProvider;
|
|
||||||
use SilverStripe\Forms\GridField\GridField_URLHandler;
|
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\View\ArrayData;
|
use SilverStripe\View\ArrayData;
|
||||||
|
|
||||||
|
use SilverStripe\Dev\Deprecation;
|
||||||
|
use SilverStripe\Forms\FormAction;
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\View\Requirements;
|
||||||
|
use SilverStripe\Control\Controller;
|
||||||
|
use SilverStripe\Core\Config\Config;
|
||||||
|
use Colymba\BulkUpload\BulkUploadField;
|
||||||
|
use Colymba\BulkUpload\BulkUploadHandler;
|
||||||
|
use SilverStripe\Forms\GridField\GridField_URLHandler;
|
||||||
|
use SilverStripe\Forms\GridField\GridField_HTMLProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GridField component for uploading images in bulk.
|
* GridField component for uploading images in bulk.
|
||||||
@ -331,7 +332,8 @@ class BulkUploader implements GridField_HTMLProvider, GridField_URLHandler
|
|||||||
*/
|
*/
|
||||||
public function handleBulkUpload($gridField, $request)
|
public function handleBulkUpload($gridField, $request)
|
||||||
{
|
{
|
||||||
$gridField->getForm()->getController()->pushCurrent();
|
$controller = Controller::curr();
|
||||||
|
$controller->pushCurrent();
|
||||||
$handler = new \Colymba\BulkUpload\BulkUploadHandler($gridField, $this);
|
$handler = new \Colymba\BulkUpload\BulkUploadHandler($gridField, $this);
|
||||||
|
|
||||||
return $handler->handleRequest($request);
|
return $handler->handleRequest($request);
|
||||||
|
Loading…
Reference in New Issue
Block a user