mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #10696 from chrometoasters/pulls/10694-pagination-null-safe
This commit is contained in:
commit
bddad3ab39
@ -665,18 +665,11 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler
|
|||||||
*/
|
*/
|
||||||
private function getNumPages(GridField $gridField): int
|
private function getNumPages(GridField $gridField): int
|
||||||
{
|
{
|
||||||
/** @var GridFieldPaginator $component */
|
return $gridField
|
||||||
$component = $gridField
|
|
||||||
->getConfig()
|
->getConfig()
|
||||||
->getComponentByType(GridFieldPaginator::class);
|
->getComponentByType(GridFieldPaginator::class)
|
||||||
if (is_null($component)) {
|
?->getTemplateParameters($gridField)
|
||||||
return 1;
|
?->toMap()['NumPages'] ?? 1;
|
||||||
}
|
|
||||||
$params = $component->getTemplateParameters($gridField);
|
|
||||||
if (is_null($params)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return $params->toMap()['NumPages'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user