diff --git a/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php b/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php index 6b95319524c..1191cc99d2d 100644 --- a/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php +++ b/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php @@ -665,18 +665,11 @@ private function getAdjacentRecordID($offset) */ private function getNumPages(GridField $gridField): int { - /** @var GridFieldPaginator $component */ - $component = $gridField - ->getConfig() - ->getComponentByType(GridFieldPaginator::class); - if (is_null($component)) { - return 1; - } - $params = $component->getTemplateParameters($gridField); - if (is_null($params)) { - return 1; - } - return $params->toMap()['NumPages']; + return $gridField + ->getConfig() + ->getComponentByType(GridFieldPaginator::class) + ?->getTemplateParameters($gridField) + ?->toMap()['NumPages'] ?? 1; } /**