-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
158 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of SilverWare. | ||
* | ||
* PHP version >=5.6.0 | ||
* | ||
* For full copyright and license information, please view the | ||
* LICENSE.md file that was distributed with this source code. | ||
* | ||
* @package SilverWare\Extensions\Model | ||
* @author Colin Tucker <colin@praxis.net.au> | ||
* @copyright 2017 Praxis Interactive | ||
* @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause | ||
* @link https://github.com/praxisnetau/silverware | ||
*/ | ||
|
||
namespace SilverWare\Extensions\Model; | ||
|
||
use SilverStripe\Core\Extension; | ||
|
||
/** | ||
* An extension which works around a URL ampersand-encoding bug with paginated lists. | ||
* | ||
* @package SilverWare\Extensions\Model | ||
* @author Colin Tucker <colin@praxis.net.au> | ||
* @copyright 2017 Praxis Interactive | ||
* @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause | ||
* @link https://github.com/praxisnetau/silverware | ||
*/ | ||
class PaginatedListExtension extends Extension | ||
{ | ||
/** | ||
* Answers a summarised pagination for the extended object (fixes a bug with URL ampersands). | ||
* | ||
* @param integer $context | ||
* | ||
* @return ArrayList | ||
*/ | ||
public function PageSummary($context = 4) | ||
{ | ||
$summary = $this->owner->PaginationSummary($context); | ||
|
||
foreach ($summary as $page) { | ||
|
||
if ($page->Link) { | ||
$page->Link = str_replace('&', '&', $page->Link); | ||
} | ||
|
||
} | ||
|
||
return $summary; | ||
} | ||
} |