Skip to content

Commit

Permalink
allow yml for export limit
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed May 2, 2024
1 parent a89bc6a commit 4461d79
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ExcelGridFieldExportButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ protected function retrieveList($gridField)
}

$list = $items;
$limit = ExcelImportExport::$limit_exports;
$limit = ExcelImportExport::getExportLimit();
if ($list instanceof DataList) {
if ($this->isLimited && $limit > 0) {
$list = $list->limit($limit);
Expand Down
13 changes: 13 additions & 0 deletions src/ExcelImportExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ class ExcelImportExport
*/
public static $limit_exports = 1000;

/**
* You can override the static var with yml config if needed
* @return int
*/
public static function getExportLimit()
{
$v = self::config()->export_limit;
if ($v) {
return $v;
}
return self::$limit_exports;
}

/**
* Get all db fields for a given dataobject class
*
Expand Down

3 comments on commit 4461d79

@RVXD
Copy link
Contributor

@RVXD RVXD commented on 4461d79 May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Thomas, nice solution!
Can you also implement this into the older 2 branch?
Regards,
Remy

@lekoala
Copy link
Owner Author

@lekoala lekoala commented on 4461d79 May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tagged 2.1.4

@RVXD
Copy link
Contributor

@RVXD RVXD commented on 4461d79 May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks!

Please sign in to comment.