diff options
author | Bartosz Dziewoński <matma.rex@gmail.com> | 2022-06-10 17:57:15 +0200 |
---|---|---|
committer | Bartosz Dziewoński <matma.rex@gmail.com> | 2023-03-22 15:23:56 +0000 |
commit | 1e86517db52d5c2d45ee30935834f94ab47b1223 (patch) | |
tree | 8e56b4d4553a77f47527f5be96531c56c550f6fb /includes/Navigation | |
parent | 8407e4454625d8516906212c10fabed68e474775 (diff) | |
download | mediawikicore-1e86517db52d5c2d45ee30935834f94ab47b1223.tar.gz mediawikicore-1e86517db52d5c2d45ee30935834f94ab47b1223.zip |
Remove deprecated pager methods/classes
Deprecated in MW 1.39:
* Ic75bd597b210e14612ca3aebb531b659897e8294
* I4e2f36b543462aa5d852733da650fb70d49ebf06
Hard-deprecated in MW 1.40:
* I09e9203b19e3808af9348db8a889d5e118282230
Change-Id: I17bd8f80e87a04674e826d7966aa3ddb011fc7ba
Diffstat (limited to 'includes/Navigation')
-rw-r--r-- | includes/Navigation/PagerNavigationBuilder.php | 22 | ||||
-rw-r--r-- | includes/Navigation/PrevNextNavigationRenderer.php | 84 |
2 files changed, 0 insertions, 106 deletions
diff --git a/includes/Navigation/PagerNavigationBuilder.php b/includes/Navigation/PagerNavigationBuilder.php index fe1ea2c32504..e386b4d2cb9c 100644 --- a/includes/Navigation/PagerNavigationBuilder.php +++ b/includes/Navigation/PagerNavigationBuilder.php @@ -62,11 +62,6 @@ class PagerNavigationBuilder { /** @var string|null */ private $limitTooltipMsg = null; - /** @var callable|null $callback Function to call instead of makeLink(). - * See IndexPager::makeLink() for the expected signature. - */ - private $makeLinkCallback = null; - /** * @param MessageLocalizer $messageLocalizer */ @@ -237,18 +232,6 @@ class PagerNavigationBuilder { } /** - * @deprecated since 1.39 - * @param callable|null $callback Function to call instead of makeLink(). - * See IndexPager::makeLink() for the expected signature. - * @return $this - */ - public function setMakeLinkCallback( ?callable $callback ): PagerNavigationBuilder { - wfDeprecated( __METHOD__, '1.39' ); - $this->makeLinkCallback = $callback; - return $this; - } - - /** * @param mixed $key * @param mixed ...$params * @return Message @@ -271,11 +254,6 @@ class PagerNavigationBuilder { protected function makeLink( ?array $query, ?string $class, string $text, ?string $tooltip, ?string $rel = null ): string { - if ( $this->makeLinkCallback ) { - $type = substr( $class, strlen( 'mw-' ), -strlen( 'link' ) ); - return ( $this->makeLinkCallback )( $text, $query, $type ); - } - if ( $query !== null ) { $title = Title::castFromPageReference( $this->page ); return Html::element( diff --git a/includes/Navigation/PrevNextNavigationRenderer.php b/includes/Navigation/PrevNextNavigationRenderer.php deleted file mode 100644 index 9595c668bf44..000000000000 --- a/includes/Navigation/PrevNextNavigationRenderer.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -/** - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @file - */ - -namespace MediaWiki\Navigation; - -use MediaWiki\Title\Title; -use MessageLocalizer; - -/** - * Helper class for generating prev/next links for paging. - * - * @deprecated since 1.39 Use PagerNavigationBuilder instead - * @since 1.34 - */ -class PrevNextNavigationRenderer { - - /** - * @var MessageLocalizer - */ - private $messageLocalizer; - - /** - * @param MessageLocalizer $messageLocalizer - */ - public function __construct( MessageLocalizer $messageLocalizer ) { - wfDeprecated( __CLASS__, '1.39' ); - $this->messageLocalizer = $messageLocalizer; - } - - /** - * Generate (prev x| next x) (20|50|100...) type links for paging (only suitable when paging by - * numeric offset, not when paging by index) - * - * @param Title $title Title object to link - * @param int $offset - * @param int $limit - * @param array $query Optional URL query parameter string - * @param bool $atend Optional param for specified if this is the last page - * @return string - */ - public function buildPrevNextNavigation( - Title $title, - $offset, - $limit, - array $query = [], - $atend = false - ) { - $navBuilder = new PagerNavigationBuilder( $this->messageLocalizer ); - $navBuilder - ->setPage( $title ) - ->setLinkQuery( [ 'limit' => $limit, 'offset' => $offset ] + $query ) - ->setLimitLinkQueryParam( 'limit' ) - ->setCurrentLimit( $limit ) - ->setPrevTooltipMsg( 'prevn-title' ) - ->setNextTooltipMsg( 'nextn-title' ) - ->setLimitTooltipMsg( 'shown-title' ); - - if ( $offset > 0 ) { - $navBuilder->setPrevLinkQuery( [ 'offset' => (string)max( $offset - $limit, 0 ) ] ); - } - if ( !$atend ) { - $navBuilder->setNextLinkQuery( [ 'offset' => (string)( $offset + $limit ) ] ); - } - - return $navBuilder->getHtml(); - } -} |