Skip to content

Commit fc46845

Browse files
committed
ignore /SearchForm endpoint
1 parent 130c0f0 commit fc46845

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/ActionsGridFieldItemRequest.php

+28
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ protected function getAvailableActions($actions)
9797
return $list;
9898
}
9999

100+
/**
101+
* This module does not interact with the /schema/SearchForm endpoint
102+
* and therefore all requests for these urls don't need any special treatement
103+
*
104+
* @return bool
105+
*/
106+
protected function isSearchFormRequest(): bool
107+
{
108+
if (!Controller::has_curr()) {
109+
return false;
110+
}
111+
$curr = Controller::curr();
112+
if ($curr) {
113+
return str_contains($curr->getRequest()->getURL(), '/schema/SearchForm');
114+
}
115+
return false;
116+
}
117+
100118
/**
101119
* Called by CMSMain, typically in the CMS or in the SiteConfig admin
102120
* CMSMain already uses getCMSActions so we are good to go with anything defined there
@@ -106,6 +124,11 @@ protected function getAvailableActions($actions)
106124
*/
107125
public function updateEditForm(Form $form)
108126
{
127+
// Ignore search form requests
128+
if ($this->isSearchFormRequest()) {
129+
return;
130+
}
131+
109132
$actions = $form->Actions();
110133

111134
// We create a Drop-Up menu afterwards because it may already exist in the $CMSActions
@@ -123,6 +146,11 @@ public function updateEditForm(Form $form)
123146
*/
124147
public function updateFormActions($actions)
125148
{
149+
// Ignore search form requests
150+
if ($this->isSearchFormRequest()) {
151+
return;
152+
}
153+
126154
$record = $this->owner->getRecord();
127155

128156
// We get the actions as defined on our record

0 commit comments

Comments
 (0)