From fc46845d607227255714222769ff8263e235f6aa Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 3 May 2024 15:20:49 +0200 Subject: [PATCH] ignore /SearchForm endpoint --- src/ActionsGridFieldItemRequest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/ActionsGridFieldItemRequest.php b/src/ActionsGridFieldItemRequest.php index 5aaac0a..9d2df62 100644 --- a/src/ActionsGridFieldItemRequest.php +++ b/src/ActionsGridFieldItemRequest.php @@ -97,6 +97,24 @@ protected function getAvailableActions($actions) return $list; } + /** + * This module does not interact with the /schema/SearchForm endpoint + * and therefore all requests for these urls don't need any special treatement + * + * @return bool + */ + protected function isSearchFormRequest(): bool + { + if (!Controller::has_curr()) { + return false; + } + $curr = Controller::curr(); + if ($curr) { + return str_contains($curr->getRequest()->getURL(), '/schema/SearchForm'); + } + return false; + } + /** * Called by CMSMain, typically in the CMS or in the SiteConfig admin * CMSMain already uses getCMSActions so we are good to go with anything defined there @@ -106,6 +124,11 @@ protected function getAvailableActions($actions) */ public function updateEditForm(Form $form) { + // Ignore search form requests + if ($this->isSearchFormRequest()) { + return; + } + $actions = $form->Actions(); // We create a Drop-Up menu afterwards because it may already exist in the $CMSActions @@ -123,6 +146,11 @@ public function updateEditForm(Form $form) */ public function updateFormActions($actions) { + // Ignore search form requests + if ($this->isSearchFormRequest()) { + return; + } + $record = $this->owner->getRecord(); // We get the actions as defined on our record