src/GridFieldRestoreAction.php
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
    {
        if ($actionName == 'restore') {
            /** @var DataObject $item */
            $item = $gridField->getList()->byID($arguments['RecordID']);
            if (!$item) {
                return;
            }

            $message = RestoreAction::restore($item);

            // If this is handled in a form context then show a message
            if ($message && $controller = $gridField->form->controller) {
                $controller->getResponse()->addHeader('X-Message-Text', $message['text']);
                $controller->getResponse()->addHeader('X-Message-Type', $message['type']);
            }

            $gridField->getList()->remove($item);
        }
    }
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
    {
        if ($actionName == 'restore') {
            /** @var DataObject $item */
            $item = $gridField->getList()->byID($arguments['RecordID']);
            if (!$item) {
                return;
            }

            $message = RestoreAction::restore($item);

            // If this is handled in a form context then show a message
            if ($message && $controller = $gridField->form->controller) {
                $controller->getResponse()->addHeader('X-Message-Text', $message['text']);
                $controller->getResponse()->addHeader('X-Message-Type', $message['type']);
            }

            $gridField->getList()->remove($item);
        }
    }
public function handleAction ( GridField $ gridField , $ actionName , $ arguments , $ data ) { if ( $ actionName == 'restore' ) { /** @var DataObject $item */ $ item = $ gridField -> getList ( ) -> byID ( $ arguments [ 'RecordID' ] ) ; if ( ! $ item ) { return ; } $ message = RestoreAction :: restore ( $ item ) ; // If this is handled in a form context then show a message if ( $ message && $ controller = $ gridField -> form -> controller ) { $ controller -> getResponse ( ) -> addHeader ( 'X-Message-Text' , $ message [ 'text' ] ) ; $ controller -> getResponse ( ) -> addHeader ( 'X-Message-Type' , $ message [ 'type' ] ) ; } $ gridField -> getList ( ) -> remove ( $ item ) ; } }
Handle the actions and apply any changes to the GridField.

@param GridField $gridField
@param string $actionName
@param mixed $arguments
@param array $data - form data

@return void
Handle the actions and apply any changes to the GridField .