Skip to content

Commit

Permalink
Removed custom interface for SessionGridFieldStateManager, the extra …
Browse files Browse the repository at this point in the history
…methods

will be incorporated into GridFieldStateManagerInterface in the future.
  • Loading branch information
forsdahl committed Jun 20, 2024
1 parent e9cd597 commit 898ef9b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ protected function getFormActions()

$gridState = $this->gridField->getState(false);
$actions->push(HiddenField::create($manager->getStateKey($this->gridField), null, $gridState));
if ($manager instanceof GridFieldStateStoreInterface) {
if (ClassInfo::hasMethod($manager, 'getStateRequestVar')) {
$stateRequestVar = $manager->getStateRequestVar();
$stateValue = $this->getRequest()->requestVar($stateRequestVar);
if ($stateValue) {
Expand Down
10 changes: 0 additions & 10 deletions src/Forms/GridField/GridFieldStateStoreInterface.php

This file was deleted.

4 changes: 3 additions & 1 deletion src/Forms/GridField/GridState_Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace SilverStripe\Forms\GridField;

use SilverStripe\Core\ClassInfo;

/**
* Simple set of data, similar to stdClass, but without the notice-level
* errors.
Expand Down Expand Up @@ -86,7 +88,7 @@ public function getData($name, $default = null)
public function storeData()
{
$stateManager = $this->getStateManager();
if ($stateManager instanceof GridFieldStateStoreInterface) {
if (ClassInfo::hasMethod($stateManager, 'storeState')) {
$stateManager->storeState($this->state->getGridField(), $this->state->Value());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/GridField/SessionGridFieldStateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* (i.e. the state is changed from the default).
* If a session state key is present in the request, it will always be used instead of generating a new one.
*/
class SessionGridFieldStateManager implements GridFieldStateManagerInterface, GridFieldStateStoreInterface
class SessionGridFieldStateManager implements GridFieldStateManagerInterface
{
protected static $state_ids = [];

Expand Down

0 comments on commit 898ef9b

Please sign in to comment.